File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -65,22 +65,23 @@ RUN apt-get update && apt-get install -y \
6565 && apt-get clean \
6666 && rm -rf /var/lib/apt/lists/*
6767
68- # Copy the virtual environment from the builder stage
69- COPY --from=builder /app/.venv /app/.venv
70- COPY --from=builder /app/artifacts /app/artifacts
71- COPY --from=builder /app /app
68+ # Create the application user and docker group before copying app files so we
69+ # can set ownership in a single COPY layer instead of a separate chown layer.
70+ RUN useradd --create-home --shell /bin/bash app && \
71+ (groupadd -g 999 docker || true) && \
72+ usermod -aG docker app
73+
74+ # Copy the application and virtual environment from the builder stage with
75+ # correct ownership. This avoids an extra chown -R layer over /app.
76+ COPY --from=builder --chown=app:app /app /app
7277
7378# Add the virtual environment to PATH
7479# This allows us to run "uvicorn" or "python" directly without "uv run"
7580ENV PATH="/app/.venv/bin:$PATH"
7681
77- # Setup permissions
82+ # Install the entrypoint script
7883COPY scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
79- RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
80- useradd --create-home --shell /bin/bash app && \
81- groupadd -g 999 docker || true && \
82- usermod -aG docker app && \
83- chown -R app:app /app
84+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
8485
8586USER app
8687
You can’t perform that action at this time.
0 commit comments