Skip to content

Commit 5749ed2

Browse files
committed
fix: add docker-entrypoint.sh to image and set as ENTRYPOINT
The entrypoint script was in the repo but not copied into the Docker image, causing "executable file not found" on container start. Now the Dockerfile installs su-exec, copies the entrypoint, and uses it to fix bind-mount permissions as root before dropping to the chronicle user. Removes compose user: directive since the entrypoint handles it. https://claude.ai/code/session_0153nX7vQSjEFPpZTgZdDmu5
1 parent 2f8d840 commit 5749ed2

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ 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) and timezone data.
46-
RUN apk add --no-cache ca-certificates tzdata
45+
# Install CA certificates for HTTPS calls, timezone data, and su-exec for
46+
# dropping privileges in the entrypoint.
47+
RUN apk add --no-cache ca-certificates tzdata su-exec
4748

4849
# Create non-root user for runtime security.
4950
RUN adduser -D -H -s /sbin/nologin chronicle
@@ -64,8 +65,10 @@ RUN mkdir -p /app/data/media && chown -R chronicle:chronicle /app/data
6465

6566
WORKDIR /app
6667

67-
# Run as the unprivileged chronicle user.
68-
USER chronicle
68+
# Copy entrypoint script that fixes bind-mount permissions, then drops to
69+
# the unprivileged chronicle user via su-exec.
70+
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
71+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
6972

7073
# The Go binary serves HTTP directly on this port.
7174
EXPOSE 8080
@@ -74,5 +77,7 @@ EXPOSE 8080
7477
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
7578
CMD wget -qO- http://localhost:8080/healthz || exit 1
7679

77-
# Run the Chronicle server.
80+
# Container starts as root; the entrypoint fixes permissions then exec's
81+
# the server as the chronicle user.
82+
ENTRYPOINT ["docker-entrypoint.sh"]
7883
CMD ["chronicle"]

docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ 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}"
2623
ports:
2724
- "8080:8080"
2825
restart: unless-stopped

0 commit comments

Comments
 (0)