File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11# Use the official Python image from the Docker Hub
22FROM python:3.13.2-slim-bookworm AS base
33
4+ ARG APP_GID=10000
5+ ARG APP_UID=16997
6+
47RUN apt-get update && \
58 apt-get install -y --no-install-recommends \
69 openssh-client && \
@@ -11,18 +14,23 @@ ENV PYTHONUNBUFFERED=1
1114
1215COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
1316
17+ # create user/group
18+ RUN groupadd -g $APP_GID appgroup && \
19+ useradd -m -u $APP_UID -g $APP_GID appuser
20+ USER appuser
21+
1422# Change the working directory to the `app` directory
1523WORKDIR /app
1624
1725# Copy the lockfile and `pyproject.toml` into the image
18- COPY uv.lock /app/uv.lock
19- COPY pyproject.toml /app/pyproject.toml
26+ COPY --chown=appuser:appgroup uv.lock /app/uv.lock
27+ COPY --chown=appuser:appgroup pyproject.toml /app/pyproject.toml
2028
2129# Install dependencies
2230RUN uv sync --frozen --no-install-project
2331
2432# Copy the project into the image
25- COPY . /app
33+ COPY --chown=appuser:appgroup . /app
2634
2735# Sync the project
2836RUN uv sync --frozen
You can’t perform that action at this time.
0 commit comments