From 1e1e060a77b703d472d0c20547792df866f19d1e Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:37:55 +0000 Subject: [PATCH] closes #342 --- Dockerfile | 10 ++++++++++ docker-compose.yaml | 3 +++ 2 files changed, 13 insertions(+) diff --git a/Dockerfile b/Dockerfile index de1e785..72b9e9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,11 +41,21 @@ COPY ./src/ . RUN /poetry-venv/bin/poetry install --only main --no-cache +# Run as non-root user to avoid permission issues with mounted volumes (see #342) +# The base image already has an 'ubuntu' user at UID/GID 1000. +# Ensure directories that need write access at runtime are writable. +RUN chown 1000:1000 /app && \ + chown -R 1000:1000 /app/.venv/lib/python3.12/site-packages/seleniumbase/drivers/ && \ + mkdir -p /app/local_archive /app/secrets /tmp/archive && \ + chown -R 1000:1000 /app/local_archive /app/secrets /tmp/archive + # Update PATH to include virtual environment binaries # Allowing entry point to run the application directly with Python ENV VIRTUAL_ENV=/app/.venv \ PATH="/app/.venv/bin:$PATH" +USER 1000 + ENTRYPOINT ["python3", "-m", "auto_archiver"] # should be executed with 2 volumes (3 if local_storage is used) diff --git a/docker-compose.yaml b/docker-compose.yaml index 07ceb00..5494a92 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,6 +6,9 @@ services: context: . dockerfile: Dockerfile container_name: auto-archiver + # Override user to match host UID/GID and avoid permission issues on volumes. + # Set USER_ID and GROUP_ID env vars, or defaults to 1000:1000. + user: "${USER_ID:-1000}:${GROUP_ID:-1000}" volumes: - ./secrets:/app/secrets - ./local_archive:/app/local_archive