Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (54 loc) · 2.11 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (54 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# ---------- Stage 1: build the Svelte frontend ----------
FROM node:22-slim AS frontend
# Git commit of the sources (hash and ISO date), shown in Settings: the image has no .git, so they come from the build
# (see compose.yaml): NOCUMENT_COMMIT=$(git rev-parse HEAD) NOCUMENT_COMMIT_DATE=$(git log -1 --format=%cI) ...
ARG NOCUMENT_COMMIT=""
ARG NOCUMENT_COMMIT_DATE=""
ENV NOCUMENT_COMMIT=$NOCUMENT_COMMIT \
NOCUMENT_COMMIT_DATE=$NOCUMENT_COMMIT_DATE
WORKDIR /web
COPY web/package.json web/package-lock.json ./
RUN npm ci
# The translations are imported from ../locales (shared with the backend).
COPY locales/ /locales/
COPY web/ ./
RUN npm run build
# ---------- Stage 2: Flask backend + nginx serving the frontend ----------
FROM python:3.12-slim-bookworm
ARG NOCUMENT_COMMIT=""
ARG NOCUMENT_COMMIT_DATE=""
ENV NOCUMENT_COMMIT=$NOCUMENT_COMMIT \
NOCUMENT_COMMIT_DATE=$NOCUMENT_COMMIT_DATE \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
SOFFICE_PATH=/usr/bin/soffice \
SOFFICE_TIMEOUT=120 \
UNO_PYTHON=/usr/bin/python3
# LibreOffice (DOCX -> PDF conversion), python3-uno (table of contents update, run with the system
# python3, see UNO_PYTHON), fonts for faithful rendering, nginx for the frontend
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice-writer-nogui \
python3-uno \
fonts-dejavu \
fonts-liberation \
fonts-liberation2 \
fonts-crosextra-carlito \
fonts-crosextra-caladea \
nginx \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /etc/nginx/sites-enabled/default
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt gunicorn
COPY src/ ./src/
COPY locales/ ./locales/
# Plugins shipped with the image (e.g. the example); the folder is a volume in compose.yaml, so the plugins installed
# from the web app survive a new image.
COPY plugins/ ./plugins/
COPY --from=frontend /web/dist /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/conf.d/nocument.conf
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
CMD ["/entrypoint.sh"]