Spaces:
Running
Running
| # Dockerfile | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV TZ=Etc/UTC | |
| # Install Chrome and dependencies for HuggingFace Spaces | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| chromium \ | |
| chromium-driver \ | |
| ca-certificates \ | |
| fonts-liberation \ | |
| libasound2 \ | |
| libatk-bridge2.0-0 \ | |
| libdrm2 \ | |
| libgtk-3-0 \ | |
| libnspr4 \ | |
| libnss3 \ | |
| libxss1 \ | |
| libxtst6 \ | |
| libgbm1 \ | |
| libxrandr2 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| procps \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first | |
| COPY requirements.txt . | |
| # Install Python packages as root BEFORE switching users | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Now switch to non-root user for HuggingFace Spaces | |
| USER 1000 | |
| # Set environment for user 1000 | |
| ENV HOME=/tmp/hf-user | |
| ENV PYTHONUSERBASE=/tmp/hf-user/.local | |
| ENV PATH="/tmp/hf-user/.local/bin:$PATH" | |
| # Copy application files | |
| COPY --chown=1000:1000 . . | |
| # Create config directory | |
| RUN mkdir -p config | |
| EXPOSE 7860 | |
| CMD ["python", "server.py"] |