Spaces:
Build error
Build error
File size: 1,941 Bytes
2988d6e 9ee640f 2988d6e 9ee640f 2988d6e 9ee640f 2988d6e 9ee640f cb5af19 9ee640f 2988d6e aeece2a 9ee640f aeece2a 2988d6e 4e2553d 2988d6e 4e2553d 2988d6e 9ee640f 2988d6e 9ee640f 2988d6e 9ee640f 2988d6e fe9ee59 |
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 56 57 58 59 60 61 62 63 64 65 |
FROM python:3.10-slim
# Environment variables to optimize Python
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
# Install dependencies, including those required for Google Chrome
RUN apt-get update && apt-get install -y \
wget \
curl \
unzip \
gnupg \
ca-certificates \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libgdk-pixbuf2.0-0 \
libnspr4 \
libnss3 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
libgbm1 \
libvulkan1 \
procps \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*
# Install Google Chrome (pinned to 136.0.7103.113)
RUN wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_136.0.7103.113-1_amd64.deb && \
dpkg -i google-chrome-stable_136.0.7103.113-1_amd64.deb && \
apt-get -fy install && \
rm google-chrome-stable_136.0.7103.113-1_amd64.deb
# Install ChromeDriver (pinned to 136.0.7103.113)
RUN wget -q -O /tmp/chromedriver.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/136.0.7103.113/linux64/chromedriver-linux64.zip && \
unzip /tmp/chromedriver.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ && \
mv /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver && \
chmod +x /usr/local/bin/chromedriver && \
rm -rf /tmp/chromedriver.zip /usr/local/bin/chromedriver-linux64
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . /app
# Expose port for FastAPI
EXPOSE 7860
# Ensure ChromeDriver is in PATH
ENV PATH="/usr/local/bin:$PATH"
# Run FastAPI application with single worker
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |