npv2k1 commited on
Commit
2a99322
·
1 Parent(s): 5e4ff04

Refactor Dockerfile to streamline Chrome and ChromeDriver installation; set display port to avoid crashes

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -20
Dockerfile CHANGED
@@ -2,26 +2,18 @@
2
  FROM ghcr.io/astral-sh/uv:python3.11-bookworm
3
 
4
  # Install Chrome and dependencies
5
- RUN apt-get update && apt-get install -y \
6
- wget \
7
- gnupg \
8
- curl \
9
- unzip \
10
- && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
11
- && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
12
- && apt-get update \
13
- && apt-get install -y \
14
- google-chrome-stable \
15
- && rm -rf /var/lib/apt/lists/*
16
-
17
- # Install ChromeDriver
18
- RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | awk -F'.' '{print $1}') \
19
- && CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION") \
20
- && wget -q "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
21
- && unzip chromedriver_linux64.zip \
22
- && mv chromedriver /usr/local/bin/ \
23
- && chmod +x /usr/local/bin/chromedriver \
24
- && rm chromedriver_linux64.zip
25
 
26
  # Create a non-root user
27
  RUN useradd -m -u 1000 appuser
 
2
  FROM ghcr.io/astral-sh/uv:python3.11-bookworm
3
 
4
  # Install Chrome and dependencies
5
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
6
+ RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
7
+ RUN apt-get -y update
8
+ RUN apt-get install -y google-chrome-stable
9
+
10
+ # install chromedriver
11
+ RUN apt-get install -yqq unzip
12
+ RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
13
+ RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
14
+
15
+ # set display port to avoid crash
16
+ ENV DISPLAY=:99
 
 
 
 
 
 
 
 
17
 
18
  # Create a non-root user
19
  RUN useradd -m -u 1000 appuser