Forgotten tesseract and imagemagick
[redakcja.git] / Dockerfile
1 FROM python:3.10-slim-trixie AS base
2
3 ARG UID=8200
4 ARG GID=8200
5
6 RUN apt-get update \
7  && apt-get install -y --no-install-recommends \
8     imagemagick tesseract-ocr tesseract-ocr-pol \
9  && rm -rf /var/lib/apt/lists/*
10
11 COPY requirements/requirements.txt requirements.txt
12
13 RUN --mount=type=cache,target=/root/.cache/pip \
14     pip install -r requirements.txt
15
16 RUN addgroup --gid $GID app && \
17     adduser --gid $GID --home /app --uid $UID app
18
19 USER app
20
21 WORKDIR /app/src
22
23
24
25
26 FROM base AS dev
27
28 USER root
29 RUN --mount=type=cache,target=/root/.cache/pip \
30     pip install --no-cache-dir coverage
31 USER app
32
33
34
35
36 FROM base AS prod-base
37
38 USER root
39
40 RUN --mount=type=cache,target=/root/.cache/pip \
41     pip install --no-cache-dir gunicorn
42
43 USER app
44
45 COPY src /app/src
46
47
48
49 FROM prod-base AS static-builder
50
51 RUN python manage.py collectstatic --noinput
52
53
54 FROM nginx:alpine AS nginx
55
56 ARG UID=8200
57 ARG GID=8200
58
59 COPY scripts/nginx.conf /etc/nginx/conf.d/default.conf
60
61 RUN addgroup -g $GID app && addgroup nginx app
62 COPY --from=static-builder /app/var/static /app/var/static
63
64
65
66
67 FROM prod-base AS prod
68
69 COPY --from=static-builder /app/var/static/staticfiles.json /app/var/static/staticfiles.json