Spaces:
Build error
Build error
Update dockerfile
Browse files- dockerfile +46 -10
dockerfile
CHANGED
|
@@ -5,23 +5,59 @@ RUN apt-get update && apt-get install -y \
|
|
| 5 |
wget \
|
| 6 |
gnupg \
|
| 7 |
unzip \
|
|
|
|
| 8 |
libx11-6 \
|
| 9 |
libnss3 \
|
| 10 |
libgconf-2-4 \
|
| 11 |
libfontconfig1 \
|
| 12 |
libxrender1 \
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
RUN wget -q -O
|
| 21 |
-
&&
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
WORKDIR /app
|
| 27 |
|
|
|
|
| 5 |
wget \
|
| 6 |
gnupg \
|
| 7 |
unzip \
|
| 8 |
+
curl \
|
| 9 |
libx11-6 \
|
| 10 |
libnss3 \
|
| 11 |
libgconf-2-4 \
|
| 12 |
libfontconfig1 \
|
| 13 |
libxrender1 \
|
| 14 |
+
libx11-xcb1 \
|
| 15 |
+
libxcomposite1 \
|
| 16 |
+
libxcursor1 \
|
| 17 |
+
libxdamage1 \
|
| 18 |
+
libxi6 \
|
| 19 |
+
libxtst6 \
|
| 20 |
+
libxrandr2 \
|
| 21 |
+
libasound2 \
|
| 22 |
+
libatk1.0-0 \
|
| 23 |
+
libatk-bridge2.0-0 \
|
| 24 |
+
libcups2 \
|
| 25 |
+
libpangocairo-1.0-0 \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
+
# Add Google Chrome repository
|
| 29 |
+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
| 30 |
+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
| 31 |
+
|
| 32 |
+
# Install Chrome, try specific version first, fall back to latest
|
| 33 |
+
RUN apt-get update && \
|
| 34 |
+
(apt-get install -y --no-install-recommends google-chrome-stable=136.0.7103.113-1 || \
|
| 35 |
+
(echo "Specific Chrome version 136.0.7103.113-1 unavailable, installing latest" && \
|
| 36 |
+
apt-get install -y --no-install-recommends google-chrome-stable)) && \
|
| 37 |
+
rm -rf /var/lib/apt/lists/* \
|
| 38 |
+
&& google-chrome --version > /tmp/chrome-version.txt 2>&1 || echo "Chrome version check failed" > /tmp/chrome-version.txt
|
| 39 |
+
|
| 40 |
+
# Get Chrome version and install matching ChromeDriver
|
| 41 |
+
RUN CHROME_VERSION=$(cat /tmp/chrome-version.txt | grep -oP '\d+\.\d+\.\d+\.\d+' || echo "unknown") && \
|
| 42 |
+
echo "Detected Chrome version: $CHROME_VERSION" && \
|
| 43 |
+
if [ "$CHROME_VERSION" != "unknown" ]; then \
|
| 44 |
+
wget -q -O /tmp/chromedriver.zip "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROME_VERSION/linux64/chromedriver-linux64.zip" || \
|
| 45 |
+
(echo "ChromeDriver download failed for $CHROME_VERSION, trying fallback" && \
|
| 46 |
+
wget -q -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION%.*}/chromedriver_linux64.zip") && \
|
| 47 |
+
unzip /tmp/chromedriver.zip -d /usr/bin/ && \
|
| 48 |
+
mv /usr/bin/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
|
| 49 |
+
chmod +x /usr/bin/chromedriver && \
|
| 50 |
+
rm -rf /tmp/chromedriver.zip /usr/bin/chromedriver-linux64 && \
|
| 51 |
+
chromedriver --version > /tmp/chromedriver-version.txt 2>&1 || echo "ChromeDriver version check failed" > /tmp/chromedriver-version.txt; \
|
| 52 |
+
else \
|
| 53 |
+
echo "Chrome not installed, skipping ChromeDriver" > /tmp/chromedriver-version.txt; \
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
# Verify installations
|
| 57 |
+
RUN echo "Checking installed files:" && \
|
| 58 |
+
ls -l /usr/bin/google-chrome /usr/bin/chromedriver || echo "One or more binaries not found" && \
|
| 59 |
+
cat /tmp/chrome-version.txt && \
|
| 60 |
+
cat /tmp/chromedriver-version.txt
|
| 61 |
|
| 62 |
WORKDIR /app
|
| 63 |
|