Ayushnangia commited on
Commit
fd5569b
·
verified ·
1 Parent(s): f06921f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -29
Dockerfile CHANGED
@@ -1,12 +1,11 @@
1
- FROM ubuntu:bionic
2
-
3
- WORKDIR /code
4
 
5
  # Install system dependencies required for Chrome
6
  RUN apt-get update && apt-get install -y \
7
  software-properties-common \
8
  wget \
9
- xvfb \
10
  libxi6 \
11
  libgconf-2-4 \
12
  fonts-liberation \
@@ -34,43 +33,23 @@ RUN apt-get update && apt-get install -y \
34
  && apt-get clean \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
- # Add the deadsnakes PPA for Python 3.10
38
- RUN add-apt-repository ppa:deadsnakes/ppa
39
-
40
- # Install Python 3.10 and other utilities
41
  RUN apt-get update && apt-get install -y \
42
  python3.10 \
43
- python3.10-distutils \
44
  python3.10-dev \
 
 
45
  --no-install-recommends \
46
  && apt-get clean \
47
  && rm -rf /var/lib/apt/lists/*
48
 
49
- # Update alternatives to use Python 3.10 as the default Python 3 version
50
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
51
 
52
- # Install pip for Python 3.10
53
- RUN apt-get update && apt-get install -y wget \
54
- && wget https://bootstrap.pypa.io/get-pip.py \
55
- && python3.10 get-pip.py \
56
- && rm get-pip.py \
57
- && apt-get remove --purge -y wget \
58
- && apt-get clean \
59
- && rm -rf /var/lib/apt/lists/*
60
-
61
- # Download and install Google Chrome in a way that it can be run in headless mode.
62
- RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
63
- && apt install ./google-chrome-stable_current_amd64.deb -y \
64
- && rm ./google-chrome-stable_current_amd64.deb
65
-
66
- # Ensure Chrome can run in headless mode without sandboxing issues
67
- # Note: Running without the sandbox in untrusted sites is not recommended for security reasons.
68
- ENV CHROME_OPTS="--no-sandbox --disable-dev-shm-usage --headless"
69
-
70
  # Copy the requirements.txt file and install Python dependencies
71
  COPY ./requirements.txt /code/requirements.txt
72
 
73
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
74
 
75
  # Copy the rest of the application
76
  COPY . .
 
1
+ # Use a more recent Ubuntu version
2
+ FROM ubuntu:focal
 
3
 
4
  # Install system dependencies required for Chrome
5
  RUN apt-get update && apt-get install -y \
6
  software-properties-common \
7
  wget \
8
+ xvfb \
9
  libxi6 \
10
  libgconf-2-4 \
11
  fonts-liberation \
 
33
  && apt-get clean \
34
  && rm -rf /var/lib/apt/lists/*
35
 
36
+ # Install Python 3.10
 
 
 
37
  RUN apt-get update && apt-get install -y \
38
  python3.10 \
 
39
  python3.10-dev \
40
+ python3-pip \
41
+ python3-venv \
42
  --no-install-recommends \
43
  && apt-get clean \
44
  && rm -rf /var/lib/apt/lists/*
45
 
46
+ # Set Python 3.10 as the default Python version
47
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  # Copy the requirements.txt file and install Python dependencies
50
  COPY ./requirements.txt /code/requirements.txt
51
 
52
+ RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
53
 
54
  # Copy the rest of the application
55
  COPY . .