Spaces:
Build error
Build error
| FROM python:3.10-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| gnupg \ | |
| unzip \ | |
| curl \ | |
| libnss3 \ | |
| libnspr4 \ | |
| libatk1.0-0 \ | |
| libatk-bridge2.0-0 \ | |
| libcups2 \ | |
| libdrm2 \ | |
| libdbus-1-3 \ | |
| libxkbcommon0 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| libxext6 \ | |
| libxfixes3 \ | |
| libxrandr2 \ | |
| libgbm1 \ | |
| libpango-1.0-0 \ | |
| libcairo2 \ | |
| libasound2 \ | |
| fonts-liberation \ | |
| libappindicator3-1 \ | |
| libxshmfence1 \ | |
| lsb-release \ | |
| xdg-utils \ | |
| --no-install-recommends \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Google Chrome | |
| RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
| && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ | |
| && apt-get update \ | |
| && apt-get install -y google-chrome-stable \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user (Hugging Face best practice) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Download Camoufox/Firefox binaries | |
| RUN python3 -m camoufox fetch | |
| # Copy the rest of the application with proper ownership | |
| COPY --chown=user . . | |
| # Set environment variables | |
| ENV PORT=7860 | |
| ENV HEADLESS=true | |
| ENV PYTHONUNBUFFERED=1 | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["python", "src/lol.py"] | |