File size: 947 Bytes
743b34b d624fe1 743b34b d624fe1 743b34b d624fe1 743b34b 966b662 7eeeb7a 743b34b d624fe1 743b34b d624fe1 a51ef54 743b34b d624fe1 743b34b d624fe1 1b7c76e | 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 | # Use the official Playwright Python image
FROM mcr.microsoft.com/playwright/python:v1.40.0-jammy
# Set Environment Variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
DEFAULT_PORT=7860
# Set up a working directory
WORKDIR /code
# Copy requirements file
COPY requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
RUN pip install playwright-stealth
RUN playwright install --with-deps chromium
# Copy the application code
COPY . /code
# Set permissions for Hugging Face (UID 1000)
# Hugging Face Spaces environment already has a user with UID 1000
RUN chown -R 1000:1000 /code
USER 1000
# Ensure the static directory exists and is writable
RUN mkdir -p /code/static
# Expose the HF port
EXPOSE 7860
# Run the app
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
|