Minimal fixes
[redakcja.git] / Dockerfile
1 FROM python:3.10-trixie AS base
2
3 ARG UID=8200
4 ARG GID=8200
5
6 RUN     apt-get update && apt-get install -y \
7         # for epubcheck
8         default-jre \
9         git \
10         calibre \
11         texlive-xetex texlive-lang-polish \
12         texlive-extra-utils \
13         texlive-lang-greek \
14         texlive-lang-other \
15         texlive-luatex \
16         texlive-fonts-extra \
17         texlive-fonts-extra-links \
18         fonts-noto-core fonts-noto-extra
19
20
21 COPY requirements/requirements.txt requirements.txt
22
23 RUN pip install --no-cache-dir -r requirements.txt
24
25 RUN wget https://github.com/w3c/epubcheck/releases/download/v5.3.0/epubcheck-5.3.0.zip && \
26     unzip epubcheck-5.3.0.zip && \
27     rm epubcheck-5.3.0.zip && \
28     mv epubcheck-5.3.0 /opt/epubcheck
29
30
31 RUN addgroup --gid $GID app && \
32     adduser --gid $GID --home /app --uid $UID app
33
34
35 # fonts
36 RUN cp -a /usr/local/lib/python*/site-packages/librarian/fonts /usr/share/fonts
37 RUN fc-cache
38
39 USER app
40
41 WORKDIR /app/src
42
43
44 FROM base AS dev
45
46 USER root
47 RUN pip install --no-cache-dir coverage
48 USER app
49
50
51
52
53 FROM base AS prod-base
54
55 USER root
56
57 RUN pip install --no-cache-dir gunicorn
58
59 USER app
60
61 COPY src /app/src
62
63
64
65
66
67 FROM prod-base AS static-builder
68
69 RUN python manage.py collectstatic --noinput
70
71
72
73
74 FROM nginx:alpine AS nginx
75
76 ARG UID=8200
77 ARG GID=8200
78
79 # COPY nginx.conf conf.d/...
80
81 RUN addgroup -g $GID app && addgroup nginx app
82 COPY --from=static-builder /app/src/static /app/var/static
83
84
85
86
87 FROM prod-base AS prod
88
89 COPY --from=static-builder /app/src/static/staticfiles.json /app/src/static/staticfiles.json