crowdata / Dockerfile
YOSOYYONOSOYOTRO's picture
Upload folder using huggingface_hub (part 2)
4223796 verified
Raw
History Blame Contribute Delete
1.11 kB
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"]