-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile.litefs
40 lines (30 loc) · 1.37 KB
/
Dockerfile.litefs
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
37
38
39
40
# 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
# Setup our environment to include FUSE & SQLite. We install ca-certificates
# so we can communicate with the Consul server over HTTPS.
RUN apk add ca-certificates fuse3 sqlite
COPY --from=builder /build/openchangelog /app/openchangelog
COPY --from=builder /build/migrations /app/migrations
COPY --from=goose_builder /build/goose/goose /usr/bin/goose
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
# Run LiteFS as the entrypoint. After it has connected and sync'd with the
# cluster, it will run the commands listed in the "exec" field of the config.
ENTRYPOINT ["litefs", "mount"]