-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (36 loc) · 2.14 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (36 loc) · 2.14 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
# ── Base image ────────────────────────────────────────────────────────────────
FROM python:3.12-slim
# ── System deps: LibreOffice + fonts + cleanup ─────────────────────────────────
# LibreOffice is needed for docx→pdf conversion and docx-as-pdf rendering.
# fonts-liberation gives clean Latin fonts; fonts-noto covers Arabic/CJK/etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice \
libreoffice-writer \
fonts-liberation \
fonts-noto \
fonts-noto-cjk \
fonts-arabic \
libgl1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ── Working directory ──────────────────────────────────────────────────────────
WORKDIR /app
# ── Python deps (install before copying code for better layer caching) ─────────
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ── Copy application code ──────────────────────────────────────────────────────
COPY . .
# ── Runtime folders (Railway mounts an ephemeral disk here) ───────────────────
RUN mkdir -p uploads output
# ── Expose port (Railway reads $PORT at runtime) ───────────────────────────────
EXPOSE 5050
# ── Start with gunicorn (production-grade, multi-worker) ──────────────────────
# --timeout 120 gives LibreOffice conversions enough time to finish
# --workers 2 enough for personal use without eating too much RAM
CMD gunicorn app:app \
--bind 0.0.0.0:${PORT:-5050} \
--workers 2 \
--timeout 120 \
--keep-alive 5 \
--access-logfile - \
--error-logfile -