dbmate/Dockerfile
Adrian Macneil df119a76f3
Migrate to dep for dependency management (#26)
* Replace `Godeps` with `dep`
* Upgrade all dependencies
* Remove vendor source from git repository
2018-01-23 17:11:34 -08:00

34 lines
883 B
Docker

# build image
FROM golang:1.9 as build
# required to force cgo (for sqlite driver) with cross compile
ENV CGO_ENABLED 1
# 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/*
# 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
RUN go get \
github.com/golang/lint/golint \
github.com/kisielk/errcheck
# copy source files
COPY . /go/src/github.com/amacneil/dbmate
WORKDIR /go/src/github.com/amacneil/dbmate
# build
RUN make dep install build
# 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"]