Spaces:
Running
Running
# Dockerfile for lightweight Playwright + FastAPI app on Hugging Face Space | |
FROM python:3.11-slim | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
libnss3 libatk-bridge2.0-0 libgtk-3-0 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libasound2 curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Playwright and FastAPI dependencies | |
RUN pip install --no-cache-dir fastapi uvicorn "playwright>=1.37.0" httpx | |
# Install Playwright browsers | |
RUN playwright install | |
WORKDIR /app | |
COPY ./app /app | |
ENV PORT=7860 | |
EXPOSE 7860 | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |