dbmate/Dockerfile

30 lines
633 B
Text
Raw Normal View History

# build image
2019-05-19 18:52:45 -07:00
FROM golang:1.12 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 https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
2019-05-19 18:52:45 -07:00
| sh -s v1.16.0
2015-11-25 10:57:58 -08:00
# copy source files
COPY . /src
WORKDIR /src
2015-11-25 10:57:58 -08:00
# build
RUN make build
2015-11-25 10:57:58 -08:00
# runtime image
FROM gcr.io/distroless/base
COPY --from=build /src/dist/dbmate-linux-amd64 /dbmate
ENTRYPOINT ["/dbmate"]