hamza2923 commited on
Commit
a01c1c7
·
verified ·
1 Parent(s): d0bef6c

Update dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +4 -8
dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Use Python 3.9 slim
2
  FROM python:3.9-slim
3
 
4
- # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  wget \
7
  gnupg \
@@ -23,18 +23,14 @@ RUN apt-get update && apt-get install -y \
23
  libxkbcommon0 \
24
  libxrandr2 \
25
  xdg-utils \
26
- && rm -rf /var/lib/apt/lists/*
27
-
28
- # Install Chrome
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
  && apt-get update \
32
  && apt-get install -y google-chrome-stable \
33
  && rm -rf /var/lib/apt/lists/*
34
 
35
- # Install ChromeDriver (specific version that matches Chrome)
36
- RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}') \
37
- && CHROME_MAJOR_VERSION=$(echo $CHROME_VERSION | cut -d'.' -f1) \
38
  && CHROMEDRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAJOR_VERSION) \
39
  && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \
40
  && unzip /tmp/chromedriver.zip -d /usr/bin/ \
 
1
  # Use Python 3.9 slim
2
  FROM python:3.9-slim
3
 
4
+ # Install system dependencies in a single RUN layer
5
  RUN apt-get update && apt-get install -y \
6
  wget \
7
  gnupg \
 
23
  libxkbcommon0 \
24
  libxrandr2 \
25
  xdg-utils \
26
+ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
 
 
 
27
  && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
28
  && apt-get update \
29
  && apt-get install -y google-chrome-stable \
30
  && rm -rf /var/lib/apt/lists/*
31
 
32
+ # Install matching ChromeDriver version
33
+ RUN CHROME_MAJOR_VERSION=$(google-chrome-stable --version | awk '{print $3}' | cut -d'.' -f1) \
 
34
  && CHROMEDRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAJOR_VERSION) \
35
  && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \
36
  && unzip /tmp/chromedriver.zip -d /usr/bin/ \