CoolFace
Apppublic

internationalscholarsprogram/handbook-engine

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
Dockerfile58 linesDownload Raw Back to root
1FROM python:3.12-slim2 3# Playwright/Chromium system dependencies4RUN apt-get update && apt-get install -y --no-install-recommends \5    # Chromium dependencies6    libnss3 \7    libnspr4 \8    libatk1.0-0 \9    libatk-bridge2.0-0 \10    libcups2 \11    libdrm2 \12    libxkbcommon0 \13    libxcomposite1 \14    libxdamage1 \15    libxrandr2 \16    libgbm1 \17    libpango-1.0-0 \18    libcairo2 \19    libasound2 \20    libatspi2.0-0 \21    libxshmfence1 \22    # Font rendering23    fonts-liberation \24    fontconfig \25    # General utilities26    wget \27    && rm -rf /var/lib/apt/lists/*28 29WORKDIR /app30 31# Install Python dependencies32COPY requirements.txt .33RUN pip install --no-cache-dir -r requirements.txt34 35# Set browser path BEFORE install so Playwright puts browsers here36ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright37 38# Install Playwright Chromium browser + all required system deps39RUN playwright install --with-deps chromium40 41# Copy application code42COPY app/ ./app/43 44# Copy static assets (fonts & images used for PDF rendering)45COPY fonts/ ./fonts/46COPY images/ ./images/47 48# Copy env example as fallback49COPY .env.example .env.example50 51# Cloud Run injects PORT; HF Spaces uses 786052ENV PORT=786053EXPOSE 786054 55# Single worker — Playwright+Chromium is memory-heavy.56# timeout-keep-alive=300 keeps the connection open during long PDF renders.57CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1 --timeout-keep-alive 300"]58