Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +18 -11
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Fresh build 2025-04-23
|
| 2 |
FROM ubuntu:20.04
|
| 3 |
|
| 4 |
# Set working directory
|
|
@@ -6,6 +6,7 @@ WORKDIR /app
|
|
| 6 |
|
| 7 |
# Set environment variables to avoid interactive prompts
|
| 8 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 9 |
|
| 10 |
# Install system dependencies for Chrome and ChromeDriver
|
| 11 |
RUN apt-get update && apt-get install -y \
|
|
@@ -35,6 +36,8 @@ RUN apt-get update && apt-get install -y \
|
|
| 35 |
libstdc++6 \
|
| 36 |
zlib1g \
|
| 37 |
libncurses5 \
|
|
|
|
|
|
|
| 38 |
&& rm -rf /var/lib/apt/lists/*
|
| 39 |
|
| 40 |
# Install Google Chrome
|
|
@@ -42,24 +45,28 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
|
|
| 42 |
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
|
| 43 |
&& apt-get update \
|
| 44 |
&& apt-get install -y google-chrome-stable \
|
| 45 |
-
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# Install ChromeDriver matching Chrome version
|
| 48 |
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') \
|
| 49 |
-
&& 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]+') \
|
| 50 |
-
&& wget -q https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip
|
| 51 |
-
&& unzip
|
| 52 |
-
&& mv chromedriver /usr/local/bin/ \
|
| 53 |
&& chmod +x /usr/local/bin/chromedriver \
|
| 54 |
-
&& rm
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Clear Selenium cache to avoid outdated ChromeDriver
|
| 57 |
RUN rm -rf /home/user/.cache/selenium
|
| 58 |
|
| 59 |
-
# Debug: Print Chrome and ChromeDriver versions
|
| 60 |
-
RUN google-chrome --version
|
| 61 |
-
RUN chromedriver --version
|
| 62 |
-
|
| 63 |
# Copy requirements and install Python dependencies
|
| 64 |
COPY requirements.txt .
|
| 65 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
|
|
| 1 |
+
# Fresh build 2025-04-23 v5 to force rebuild
|
| 2 |
FROM ubuntu:20.04
|
| 3 |
|
| 4 |
# Set working directory
|
|
|
|
| 6 |
|
| 7 |
# Set environment variables to avoid interactive prompts
|
| 8 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 9 |
+
ENV PATH=/usr/local/bin:/usr/bin:/bin:$PATH
|
| 10 |
|
| 11 |
# Install system dependencies for Chrome and ChromeDriver
|
| 12 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 36 |
libstdc++6 \
|
| 37 |
zlib1g \
|
| 38 |
libncurses5 \
|
| 39 |
+
libx11-6 \
|
| 40 |
+
libxext6 \
|
| 41 |
&& rm -rf /var/lib/apt/lists/*
|
| 42 |
|
| 43 |
# Install Google Chrome
|
|
|
|
| 45 |
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
|
| 46 |
&& apt-get update \
|
| 47 |
&& apt-get install -y google-chrome-stable \
|
| 48 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 49 |
+
|| (echo "Chrome installation failed" && exit 1)
|
| 50 |
+
|
| 51 |
+
# Verify Chrome installation
|
| 52 |
+
RUN google-chrome --version || (echo "Chrome not found" && exit 1)
|
| 53 |
|
| 54 |
# Install ChromeDriver matching Chrome version
|
| 55 |
RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') \
|
| 56 |
+
&& 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) \
|
| 57 |
+
&& wget -q https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip \
|
| 58 |
+
&& unzip chromedriver-linux64.zip \
|
| 59 |
+
&& mv chromedriver-linux64/chromedriver /usr/local/bin/ \
|
| 60 |
&& chmod +x /usr/local/bin/chromedriver \
|
| 61 |
+
&& rm chromedriver-linux64.zip \
|
| 62 |
+
|| (echo "ChromeDriver installation failed" && exit 1)
|
| 63 |
+
|
| 64 |
+
# Verify ChromeDriver installation
|
| 65 |
+
RUN chromedriver --version || (echo "ChromeDriver not found" && exit 1)
|
| 66 |
|
| 67 |
# Clear Selenium cache to avoid outdated ChromeDriver
|
| 68 |
RUN rm -rf /home/user/.cache/selenium
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
# Copy requirements and install Python dependencies
|
| 71 |
COPY requirements.txt .
|
| 72 |
RUN pip3 install --no-cache-dir -r requirements.txt
|