Spaces:
Build error
Build error
File size: 1,508 Bytes
6fa1be7 ad8ba8a 6fa1be7 ad8ba8a 6fa1be7 ad8ba8a 6fa1be7 ad8ba8a 6fa1be7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# 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"]
|