dbmate/Dockerfile

37 lines
810 B
Text
Raw Normal View History

# build image
FROM techknowlogick/xgo:go-1.13.x as build
WORKDIR /src
ENTRYPOINT []
CMD ["/bin/bash"]
2015-11-25 10:57:58 -08:00
# enable cgo to build sqlite
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 -qq --no-install-recommends \
curl \
mysql-client \
postgresql-client \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# golangci-lint
RUN curl -fsSL -o /tmp/lint-install.sh https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
&& chmod +x /tmp/lint-install.sh \
&& /tmp/lint-install.sh -b /usr/local/bin v1.18.0 \
&& rm -f /tmp/lint-install.sh
2015-11-25 10:57:58 -08:00
# download modules
COPY go.* ./
RUN go mod download
2015-11-25 10:57:58 -08:00
# build
COPY . ./
RUN make build-linux
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"]