Simplify Makefile and docker usage (#24)

This commit is contained in:
Adrian Macneil 2018-01-22 21:49:12 -08:00 committed by GitHub
parent 2b8b849626
commit c2fc8b5441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 35 deletions

View file

@ -18,13 +18,15 @@ RUN go get \
github.com/kisielk/errcheck
# copy source files
COPY . $GOPATH/src/github.com/amacneil/dbmate
WORKDIR $GOPATH/src/github.com/amacneil/dbmate
COPY . /go/src/github.com/amacneil/dbmate
WORKDIR /go/src/github.com/amacneil/dbmate
# build
RUN go build -ldflags '-s' -o /go/bin/dbmate ./cmd/dbmate
RUN make install build
# runtime image
FROM debian:stretch-slim
COPY --from=build /go/bin/dbmate /usr/local/bin/dbmate
ENTRYPOINT ["dbmate"]
COPY --from=build /go/src/github.com/amacneil/dbmate/dist/dbmate-linux-amd64 \
/usr/local/bin/dbmate
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/dbmate"]