-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile.sqlite
36 lines (26 loc) · 1.01 KB
/
Dockerfile.sqlite
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
36
# Non alpine because of CGO glibc dependency
FROM golang:1.23 AS builder
WORKDIR /build
ENV CGO_ENABLED=1
COPY go.mod .
COPY go.sum .
RUN go mod tidy
COPY . .
RUN go build -buildvcs=false -ldflags "-s -w -extldflags '-static'" -o ./openchangelog cmd/server.go
# Build goose binary
FROM golang:1.23 AS goose_builder
WORKDIR /build
RUN git clone https://github.com/pressly/goose && \
cd goose && \
go mod tidy && \
CGO_ENABLED=0 go build -buildvcs=false -ldflags "-s -w -extldflags '-static'" -tags='no_postgres no_redshift no_tidb no_vertica no_ydb no_clickhouse no_mssql no_mysql no_libsql' -o goose ./cmd/goose
FROM alpine
ARG config=i-should-never-exists.jla
# Try to copy config, the * makes sure we don't fail if the file isn't found
COPY *$config /etc/openchangelog.yaml
RUN apk add sqlite
WORKDIR /app
COPY --from=builder /build/openchangelog ./openchangelog
COPY --from=builder /build/migrations ./migrations
COPY --from=goose_builder /build/goose/goose /usr/bin/goose
ENTRYPOINT ["/app/openchangelog"]