1 FROM python:3.10-slim-trixie AS base
7 && apt-get install -y --no-install-recommends \
8 imagemagick tesseract-ocr tesseract-ocr-pol \
9 && rm -rf /var/lib/apt/lists/*
11 COPY requirements/requirements.txt requirements.txt
13 RUN --mount=type=cache,target=/root/.cache/pip \
14 pip install -r requirements.txt
16 RUN addgroup --gid $GID app && \
17 adduser --gid $GID --home /app --uid $UID app
29 RUN --mount=type=cache,target=/root/.cache/pip \
30 pip install --no-cache-dir coverage
36 FROM base AS prod-base
40 RUN --mount=type=cache,target=/root/.cache/pip \
41 pip install --no-cache-dir gunicorn
49 FROM prod-base AS static-builder
51 RUN python manage.py collectstatic --noinput
54 FROM nginx:alpine AS nginx
59 COPY scripts/nginx.conf /etc/nginx/conf.d/default.conf
61 RUN addgroup -g $GID app && addgroup nginx app
62 COPY --from=static-builder /app/var/static /app/var/static
67 FROM prod-base AS prod
69 COPY --from=static-builder /app/var/static/staticfiles.json /app/var/static/staticfiles.json