dbmate/Dockerfile

34 lines
888 B
Text
Raw Normal View History

# build image
2018-04-15 20:48:22 -07:00
FROM golang:1.10 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
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 \
&& chmod +x /usr/local/bin/dep
2018-04-15 19:59:56 -07:00
RUN go get gopkg.in/alecthomas/gometalinter.v2 \
&& gometalinter.v2 --install
2015-11-25 10:57:58 -08:00
# copy source files
COPY . /go/src/github.com/amacneil/dbmate
WORKDIR /go/src/github.com/amacneil/dbmate
2015-11-25 10:57:58 -08:00
# build
RUN make dep install build
2015-11-25 10:57:58 -08:00
# runtime image
FROM debian:stretch-slim
COPY --from=build /go/src/github.com/amacneil/dbmate/dist/dbmate-linux-amd64 \
/usr/local/bin/dbmate
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/dbmate"]