Spaces:
Build error
Build error
| # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # you will also find guides on how best to write your Dockerfile | |
| FROM python:3.9-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| wget \ | |
| git \ | |
| build-essential \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libnss3 \ | |
| libatk-bridge2.0-0 \ | |
| libdrm2 \ | |
| libgtk-3-0 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| libxrandr2 \ | |
| libgbm1 \ | |
| libasound2 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Chrome for Playwright | |
| RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
| && sh -c 'echo deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \ | |
| && apt-get update \ | |
| && apt-get install -y google-chrome-stable \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Install Playwright browsers | |
| RUN pip install --no-cache-dir playwright \ | |
| && playwright install chromium --with-deps | |
| COPY --chown=user . /app | |
| # Create directories for screenshots and logs | |
| RUN mkdir -p screenshots logs | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |