fix: correct file ownership for non-root user in Docker

Add --chown=appuser:appuser to COPY commands in runtime stage to ensure
the appuser can read the copied files. Without this, Python fails with
PermissionError when importing modules.
This commit is contained in:
2025-12-29 20:47:21 -05:00
parent cb5604a6a7
commit 24436ccc01

View File

@@ -28,10 +28,10 @@ RUN useradd --create-home --shell /bin/bash appuser
WORKDIR /app
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
# Copy source code
COPY --from=builder /app/src ./src
COPY --from=builder --chown=appuser:appuser /app/src ./src
# Set environment
ENV PATH="/app/.venv/bin:$PATH"