dbmate/Dockerfile

31 lines
705 B
Text
Raw Normal View History

# build image
FROM golang:1.9 as build
2015-11-25 10:57:58 -08:00
2016-08-20 10:02:42 -07:00
# required to force cgo (for sqlite driver) with cross compile
2015-12-01 17:36:23 -08:00
ENV CGO_ENABLED 1
2015-11-25 10:57:58 -08:00
# install database clients
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
mysql-client \
postgresql-client \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
2015-12-01 17:36:23 -08:00
# development dependencies
2015-11-25 10:57:58 -08:00
RUN go get \
github.com/golang/lint/golint \
2016-05-21 19:03:21 -07:00
github.com/kisielk/errcheck
2015-11-25 10:57:58 -08:00
# copy source files
2015-12-03 00:17:37 -08:00
COPY . $GOPATH/src/github.com/amacneil/dbmate
WORKDIR $GOPATH/src/github.com/amacneil/dbmate
2015-11-25 10:57:58 -08:00
# build
RUN go build -ldflags '-s' -o /go/bin/dbmate ./cmd/dbmate
2015-11-25 10:57:58 -08:00
# runtime image
FROM debian:stretch-slim
COPY --from=build /go/bin/dbmate /usr/local/bin/dbmate
ENTRYPOINT ["dbmate"]