Skip to content

Commit c412fac

Browse files
authored
Merge pull request #111 from keyxmakerx/claude/fix-media-permissions-7BuTx
Claude/fix media permissions 7 bu tx
2 parents f8d4653 + 2f8d840 commit c412fac

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /chronicle ./cmd/server
4242
# --- Stage 3: Runtime ---
4343
FROM 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.
5049
RUN 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.
6463
RUN 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-
7165
WORKDIR /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.
7871
EXPOSE 8080

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)