38 lines
1.1 KiB
Docker
38 lines
1.1 KiB
Docker
# EPUB3 -> PDF converter (Flask + WeasyPrint) — Coolify / any Docker host
|
|
# WeasyPrint needs pango + fontconfig system libraries; CJK fonts for full-text support.
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PORT=8030 \
|
|
DATA_DIR=/app/data \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libpango-1.0-0 \
|
|
libpangoft2-1.0-0 \
|
|
libharfbuzz0b \
|
|
libffi8 \
|
|
shared-mime-info \
|
|
fontconfig \
|
|
fonts-dejavu-core \
|
|
fonts-noto-cjk \
|
|
&& rm -rf /var/lib/apt/lists/* && fc-cache -f
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app.py .
|
|
COPY templates/ ./templates/
|
|
|
|
# Persistent data (uploads/output/work) — mount a volume at /app/data
|
|
VOLUME ["/app/data"]
|
|
|
|
EXPOSE 8030
|
|
|
|
# Single worker: the in-memory JOBS registry must live in one process.
|
|
# Threads give concurrency while conversions run in their own worker threads.
|
|
CMD ["sh", "-c", "gunicorn app:app --bind 0.0.0.0:${PORT} --workers 1 --threads 8 --timeout 1200 --graceful-timeout 30 --access-logfile - --error-logfile -"]
|