Add docker runtime image (#21)

Closes #17
This commit is contained in:
Adrian Macneil 2018-01-07 19:08:43 -08:00 committed by GitHub
parent f150d6aeff
commit 4e01c75eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 19 deletions

View file

@ -1,4 +1,5 @@
FROM golang:1.9
# build image
FROM golang:1.9 as build
# required to force cgo (for sqlite driver) with cross compile
ENV CGO_ENABLED 1
@ -13,6 +14,9 @@ COPY . $GOPATH/src/github.com/amacneil/dbmate
WORKDIR $GOPATH/src/github.com/amacneil/dbmate
# build
RUN go install -v ./cmd/dbmate
RUN go build -ldflags '-s' -o /go/bin/dbmate ./cmd/dbmate
CMD dbmate
# runtime image
FROM debian:stretch-slim
COPY --from=build /go/bin/dbmate /usr/local/bin/dbmate
ENTRYPOINT ["dbmate"]