Spaces:
Running
Running
File size: 912 Bytes
11256ba 4e6c25e 11256ba 4e6c25e 11256ba 4e6c25e 11256ba 859a4d8 11256ba 4e6c25e 11256ba 4e6c25e 11256ba | 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 | FROM mcr.microsoft.com/playwright/python:v1.42.0-jammy
# Hugging Face Spaces requires the container to run as user ID 1000.
# The Playwright base image already has a user with UID 1000 (pwuser), so we just switch to it.
USER 1000
# Set path so pip-installed binaries are found
ENV PATH=/home/pwuser/.local/bin:$PATH
WORKDIR /app
# Install Python dependencies first (for caching)
COPY --chown=1000:1000 requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright browsers
RUN playwright install chromium
# Force cache bust for Hugging Face
ENV CACHE_BUST=20260607
# Copy the rest of the application
COPY --chown=1000:1000 . /app/
# Ensure the cache directory exists and is writable
RUN mkdir -p /app/assets/cache_png
# Hugging Face Spaces route traffic to port 7860
EXPOSE 7860
# Run the FastAPI server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|