Spaces:
Build error
Build error
Update dockerfile
Browse files- dockerfile +38 -53
dockerfile
CHANGED
|
@@ -3,69 +3,54 @@ FROM python:3.9-slim
|
|
| 3 |
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
wget \
|
| 6 |
-
gnupg \
|
| 7 |
-
unzip \
|
| 8 |
curl \
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
libpangocairo-1.0-0 \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
RUN wget -q
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 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 |
-
|
| 64 |
COPY requirements.txt .
|
| 65 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
| 3 |
# Install system dependencies
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
wget \
|
|
|
|
|
|
|
| 6 |
curl \
|
| 7 |
+
unzip \
|
| 8 |
+
gnupg \
|
| 9 |
+
fonts-liberation \
|
| 10 |
+
libappindicator3-1 \
|
| 11 |
+
libasound2 \
|
| 12 |
+
libatk-bridge2.0-0 \
|
| 13 |
+
libatk1.0-0 \
|
| 14 |
+
libcups2 \
|
| 15 |
+
libdbus-1-3 \
|
| 16 |
+
libgdk-pixbuf2.0-0 \
|
| 17 |
+
libnspr4 \
|
| 18 |
libnss3 \
|
|
|
|
|
|
|
|
|
|
| 19 |
libx11-xcb1 \
|
| 20 |
libxcomposite1 \
|
|
|
|
| 21 |
libxdamage1 \
|
|
|
|
|
|
|
| 22 |
libxrandr2 \
|
| 23 |
+
xdg-utils \
|
| 24 |
+
libgbm-dev \
|
| 25 |
+
libgtk-3-0 \
|
| 26 |
+
libxshmfence-dev \
|
|
|
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
| 29 |
+
# Install Google Chrome (latest stable)
|
| 30 |
+
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
| 31 |
+
apt-get update && \
|
| 32 |
+
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
|
| 33 |
+
rm google-chrome-stable_current_amd64.deb
|
| 34 |
+
|
| 35 |
+
# Install ChromeDriver (automatically detect version)
|
| 36 |
+
RUN CHROME_VERSION=$(google-chrome --version | sed 's/[^0-9.]*\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/') && \
|
| 37 |
+
CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}") && \
|
| 38 |
+
wget -q "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" && \
|
| 39 |
+
unzip chromedriver_linux64.zip && \
|
| 40 |
+
mv chromedriver /usr/bin/chromedriver && \
|
| 41 |
+
chmod +x /usr/bin/chromedriver && \
|
| 42 |
+
rm chromedriver_linux64.zip
|
| 43 |
+
|
| 44 |
+
# Install Python dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
COPY requirements.txt .
|
| 46 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 47 |
|
| 48 |
+
# Copy app code
|
| 49 |
+
COPY . /app
|
| 50 |
+
WORKDIR /app
|
| 51 |
|
| 52 |
+
# Expose port
|
| 53 |
+
EXPOSE 7860
|
| 54 |
|
| 55 |
+
# Run app
|
| 56 |
+
CMD ["python", "app.py"]
|