-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.postgres
More file actions
42 lines (31 loc) · 1.21 KB
/
Dockerfile.postgres
File metadata and controls
42 lines (31 loc) · 1.21 KB
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
41
42
# Demo: Postgres with DiffKeeper
FROM golang:1.23-alpine AS builder
WORKDIR /build
# Copy module definition first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy full source so local packages resolve
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o diffkeeper .
# Final image with Postgres
FROM postgres:16-alpine
# Copy DiffKeeper agent
COPY --from=builder /build/diffkeeper /usr/local/bin/diffkeeper
# Create delta storage directory
RUN mkdir -p /deltas
# Set environment variables
ENV POSTGRES_USER=postgres
# Password must be supplied at runtime via -e POSTGRES_PASSWORD or secrets management
ENV POSTGRES_DB=testdb
ENV PGDATA=/var/lib/postgresql/data
# Wrapper script to start DiffKeeper + Postgres
RUN echo '#!/bin/sh' > /entrypoint-wrapper.sh && \
echo 'exec /usr/local/bin/diffkeeper \' >> /entrypoint-wrapper.sh && \
echo ' --state-dir=/var/lib/postgresql/data \' >> /entrypoint-wrapper.sh && \
echo ' --store=/deltas/postgres.bolt \' >> /entrypoint-wrapper.sh && \
echo ' -- docker-entrypoint.sh postgres "$@"' >> /entrypoint-wrapper.sh && \
chmod +x /entrypoint-wrapper.sh
ENTRYPOINT ["/entrypoint-wrapper.sh"]
CMD []
# Volume for delta storage (small!)
VOLUME /deltas