Spaces:
Sleeping
Sleeping
Claude
Claude Sonnet 5
Add rate limiting, tests, better extraction, and HF auto-deploy
ebab0e2 unverified Download Dockerfile from Almaatla/web-scraper: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/spaces/Almaatla/web-scraper/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Almaatla/web-scraper/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Almaatla/web-scraper/resolve/main/Dockerfile
1.39 kB
| # Use the official Playwright image which includes Python and browsers | |
| # Must match the version of playwright installed via pip | |
| FROM mcr.microsoft.com/playwright/python:v1.58.0-jammy | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container at /app | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the current directory contents into the container at /app | |
| COPY . . | |
| # Create a non-root user with an arbitrary UID (1000 is standard) | |
| # The Playwright image likely already has a user 1000 (pwuser) | |
| # We will use that user instead of creating a new one to avoid conflicts | |
| # Set ownership of the working directory to the user 1000 | |
| RUN chown -R 1000:1000 /app | |
| USER 1000 | |
| # Set environment variables | |
| # Set HOME to /app to avoid guessing the user's home directory name | |
| ENV HOME=/app \ | |
| PATH=/app/.local/bin:$PATH | |
| # Expose the port that the application listens on | |
| EXPOSE 7860 | |
| # Let the container orchestrator know when the app is actually serving | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health', timeout=3)" || exit 1 | |
| # Command to run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |