dbmate/Dockerfile

34 lines
704 B
Text
Raw Permalink Normal View History

2020-11-02 20:22:59 +13:00
# development image
2021-12-19 21:08:22 -08:00
FROM golang:1.17 as dev
WORKDIR /src
2015-11-25 10:57:58 -08:00
# install database clients
RUN apt-get update \
&& apt-get install -qq --no-install-recommends \
curl \
2021-12-19 21:08:22 -08:00
file \
mariadb-client \
postgresql-client \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# golangci-lint
2021-04-07 13:51:50 -07:00
RUN curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b /usr/local/bin v1.43.0
2015-11-25 10:57:58 -08:00
# download modules
2021-12-19 21:08:22 -08:00
COPY go.* /src/
RUN go mod download
2021-12-19 21:08:22 -08:00
COPY . /src/
2020-11-02 20:22:59 +13:00
RUN make build
# release stage
FROM alpine as release
RUN apk add --no-cache \
2020-11-02 20:22:59 +13:00
mariadb-client \
postgresql-client \
sqlite \
tzdata
2021-12-19 21:08:22 -08:00
COPY --from=dev /src/dist/dbmate /usr/local/bin/dbmate
ENTRYPOINT ["/usr/local/bin/dbmate"]