File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,9 +42,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /chronicle ./cmd/server
4242# --- Stage 3: Runtime ---
4343FROM alpine:3.20
4444
45- # Install CA certificates for HTTPS calls (if needed), timezone data, and
46- # su-exec for dropping privileges in the entrypoint.
47- RUN apk add --no-cache ca-certificates tzdata su-exec
45+ # Install CA certificates for HTTPS calls (if needed) and timezone data.
46+ RUN apk add --no-cache ca-certificates tzdata
4847
4948# Create non-root user for runtime security.
5049RUN adduser -D -H -s /sbin/nologin chronicle
@@ -63,16 +62,10 @@ COPY --from=builder /src/db/migrations /app/db/migrations
6362# Mount a volume at /app/data to persist media across container rebuilds.
6463RUN mkdir -p /app/data/media && chown -R chronicle:chronicle /app/data
6564
66- # Copy entrypoint script that fixes bind-mount permissions before dropping to
67- # the non-root chronicle user.
68- COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
69- RUN chmod +x /usr/local/bin/docker-entrypoint.sh
70-
7165WORKDIR /app
7266
73- # Container starts as root so the entrypoint can fix bind-mount ownership,
74- # then drops to the chronicle user via su-exec.
75- ENTRYPOINT ["docker-entrypoint.sh" ]
67+ # Run as the unprivileged chronicle user.
68+ USER chronicle
7669
7770# The Go binary serves HTTP directly on this port.
7871EXPOSE 8080
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ services:
2020 context : .
2121 dockerfile : Dockerfile
2222 container_name : chronicle
23+ # Match the host directory owner for bind-mount permissions.
24+ # Set PUID/PGID as environment variables (default: 1000).
25+ user : " ${PUID:-1000}:${PGID:-1000}"
2326 ports :
2427 - " 8080:8080"
2528 restart : unless-stopped
You can’t perform that action at this time.
0 commit comments