Spaces:
Paused
Paused
| FROM mcr.microsoft.com/playwright/python:v1.39.0-focal | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Create a non-root user to run the app | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Create app directories | |
| WORKDIR $HOME/app | |
| RUN mkdir -p $HOME/app/screenshots && chmod 777 $HOME/app/screenshots | |
| # Install Python dependencies | |
| COPY --chown=user requirements.txt $HOME/app/ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY --chown=user app.py $HOME/app/ | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Add a healthcheck | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| # Run the application | |
| CMD ["python", "app.py"] |