40 lines
1.3 KiB
Docker
40 lines
1.3 KiB
Docker
FROM python:3.11
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
ENV PYTHONUNBUFFERED 1
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
# Install dependencies for Chrome
|
|
RUN apt-get update && apt-get install -y wget gnupg2 ca-certificates unzip \
|
|
&& wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
|
|
&& apt-get update
|
|
|
|
# Install Google Chrome
|
|
RUN apt-get install -y google-chrome-stable
|
|
|
|
# Install specific version of ChromeDriver
|
|
ARG CHROMEDRIVER_VERSION=122.0.6261.94
|
|
RUN wget -N https://storage.googleapis.com/chrome-for-testing-public/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip -P ~/ \
|
|
&& unzip ~/chromedriver-linux64.zip -d ~/ \
|
|
&& rm ~/chromedriver-linux64.zip \
|
|
&& mv -f ~/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver \
|
|
&& chown root:root /usr/local/bin/chromedriver \
|
|
&& chmod 0755 /usr/local/bin/chromedriver
|
|
|
|
# Set display port to avoid crash
|
|
ENV DISPLAY=:99
|
|
|
|
# Upgrade pip
|
|
RUN pip install --upgrade pip
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Install any needed packages specified in requirements.txt
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
CMD ["python", "main.py"]
|