dbmate/Dockerfile

35 lines
883 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
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
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
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"]