Spaces:
Sleeping
Sleeping
File size: 1,210 Bytes
9f84bcd |
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 47 48 49 50 51 |
# Use a Python base image compatible with Hugging Face Spaces
FROM python:3.11-slim
# Set the working directory inside the container
WORKDIR /app
# Prevent Python from writing pyc files and buffering stdout
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies required for Playwright + Crawl4AI
RUN apt-get update && apt-get install -y \
curl \
wget \
unzip \
git \
xvfb \
libnss3 \
libatk-bridge2.0-0 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libgbm-dev \
libasound2 \
libatk1.0-0 \
libxkbcommon0 \
libcups2 \
libgtk-3-0 \
fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright Chromium (used by Crawl4AI)
RUN playwright install --with-deps chromium
# Copy the entire app (including .env)
COPY . .
# Expose the port expected by Hugging Face (7860)
EXPOSE 7860
# Hugging Face expects the app to listen on port 7860
ENV PORT=7860
# Command to run FastAPI with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|