Spaces:
Paused
Paused
File size: 1,107 Bytes
4223796 | 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 | FROM python:3.10-slim
WORKDIR /app
# Install system dependencies for:
# - PostgreSQL (libpq-dev)
# - ddddocr OCR (libglib2.0-0 libsm6 libxext6 libxrender-dev libgl1-mesa-glx)
# - Playwright Chromium (via --with-deps)
# - curl_cffi build tools (gcc, curl)
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libpq-dev \
curl \
wget \
gnupg \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgl1 \
libgomp1 \
libssl-dev \
libsasl2-dev \
swig \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Configure Playwright browser path to be accessible by any user ID
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN mkdir -p /ms-playwright && chmod -R 777 /ms-playwright
RUN playwright install chromium --with-deps
# Copy application code
COPY . .
# Hugging Face Spaces uses port 7860 by default
EXPOSE 7860
# Start FastAPI on port 7860 (or $PORT if overridden)
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 2"]
|