1 FROM python:3.10-slim-trixie AS base
6 COPY requirements/requirements.txt requirements.txt
8 RUN --mount=type=cache,target=/root/.cache/pip \
9 pip install -r requirements.txt
11 RUN addgroup --gid $GID app && \
12 adduser --gid $GID --home /app --uid $UID app
24 RUN --mount=type=cache,target=/root/.cache/pip \
25 pip install --no-cache-dir coverage
31 FROM base AS prod-base
35 RUN --mount=type=cache,target=/root/.cache/pip \
36 pip install --no-cache-dir gunicorn
44 FROM prod-base AS static-builder
46 RUN python manage.py collectstatic --noinput
49 FROM nginx:alpine AS nginx
54 # COPY nginx.conf conf.d/...
56 RUN addgroup -g $GID app && addgroup nginx app
57 COPY --from=static-builder /app/src/static /app/var/static
62 FROM prod-base AS prod
64 COPY --from=static-builder /app/src/static/staticfiles.json /app/src/static/staticfiles.json