Spaces:
Paused
Paused
| # Use the official Playwright Python image | |
| FROM mcr.microsoft.com/playwright/python:v1.40.0-focal | |
| # The Playwright image already has a 'pwuser' with UID 1000 | |
| # Just set it as USER later | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for better caching | |
| COPY --chown=1000:1000 requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Install Playwright browsers (Chromium only to save space) | |
| RUN playwright install chromium --with-deps | |
| # Copy application code | |
| COPY --chown=1000:1000 . . | |
| # Switch to the existing user with UID 1000 | |
| USER 1000 | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |