Spaces:
Paused
Paused
File size: 2,843 Bytes
3150af7 4dab43b 80671a4 4dab43b 3150af7 4dab43b 80671a4 4dab43b 80671a4 7602456 29a0211 4dab43b dd60f43 6b79922 3150af7 80671a4 7602456 80671a4 7602456 80671a4 6b79922 3150af7 80671a4 29a0211 7602456 6b79922 7602456 6b79922 3150af7 7602456 6134c76 80671a4 4dab43b 80671a4 4dab43b |
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# Fresh build 2025-04-23 v6 to force rebuild
FROM ubuntu:20.04
# Set working directory
WORKDIR /app
# Set environment variables to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH=/usr/local/bin:/usr/bin:/bin:/usr/lib/chromium-browser:$PATH
ENV BUILD_ID=2025-04-23-v6
# Install system dependencies for Chrome and ChromeDriver
RUN apt-get update && apt-get install -y \
wget \
unzip \
curl \
python3 \
python3-pip \
libglib2.0-0 \
libnss3 \
libgconf-2-4 \
libfontconfig1 \
libxrender1 \
libxtst6 \
libxi6 \
libgbm-dev \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libpango-1.0-0 \
libcairo2 \
libgtk-3-0 \
libcups2 \
libxss1 \
libappindicator3-1 \
libindicator3-7 \
libstdc++6 \
zlib1g \
libncurses5 \
libx11-6 \
libxext6 \
libxcomposite1 \
libxrandr2 \
libgcc1 \
&& 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-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/* \
|| (echo "Chrome installation failed" && exit 1)
# Verify Chrome installation and binary location
RUN which google-chrome || (echo "google-chrome binary not found" && exit 1)
RUN google-chrome --version || (echo "Cannot run google-chrome" && exit 1)
# Install ChromeDriver matching Chrome version
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') \
&& CHROMEDRIVER_VERSION=$(curl -sS https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | grep -oP '"version":"${CHROME_VERSION}\.[0-9]+"' | grep -oP '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) \
&& wget -q https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip \
&& unzip chromedriver-linux64.zip \
&& mv chromedriver-linux64/chromedriver /usr/local/bin/ \
&& chmod +x /usr/local/bin/chromedriver \
&& rm chromedriver-linux64.zip \
|| (echo "ChromeDriver installation failed" && exit 1)
# Verify ChromeDriver installation
RUN which chromedriver || (echo "chromedriver binary not found" && exit 1)
RUN chromedriver --version || (echo "Cannot run chromedriver" && exit 1)
# Clear Selenium cache to avoid outdated ChromeDriver
RUN rm -rf /home/user/.cache/selenium
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy the app code
COPY app.py .
# Expose the port Gradio will run on
EXPOSE 7860
# Run the Gradio app
CMD ["python3", "app.py"] |