forked from amacneil/dbmate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (31 loc) · 777 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# development image
FROM golang:1.20 as dev
WORKDIR /src
RUN git config --global --add safe.directory /src
# install database clients
RUN apt-get update \
&& apt-get install -qq --no-install-recommends \
curl \
file \
mariadb-client \
postgresql-client \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# golangci-lint
RUN curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b /usr/local/bin v1.51.2
# download modules
COPY go.* /src/
RUN go mod download
COPY . /src/
RUN make build
# release stage
FROM alpine as release
RUN apk add --no-cache \
mariadb-client \
mariadb-connector-c \
postgresql-client \
sqlite \
tzdata
COPY --from=dev /src/dist/dbmate /usr/local/bin/dbmate
ENTRYPOINT ["/usr/local/bin/dbmate"]