-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (36 loc) · 1.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM python:3.11-slim
# Install necessary dependencies for Chrome and Selenium
RUN apt-get update && apt-get install --no-install-recommends -y \
wget \
unzip \
curl \
gnupg \
libnss3 \
libgconf-2-4 \
libxss1 \
libappindicator3-1 \
libasound2 \
fonts-liberation \
xdg-utils \
libgbm-dev \
libgtk-3-0 \
libu2f-udev \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Google Chrome
RUN wget -q -O /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get update \
&& apt-get install --no-install-recommends -y /tmp/google-chrome.deb \
&& rm /tmp/google-chrome.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the requirements file and install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Run the application using Chrome in headless mode
CMD ["xvfb-run", "--auto-servernum", "--server-args=-screen 0 1024x768x24", "python3", "main.py"]