-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
144a7df
commit 45c7852
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM python:latest | ||
|
||
# Set the Chrome version | ||
ENV CHROME_VERSION 131.0.6778.85 | ||
ENV CHROMEDRIVER_VERSION ${CHROME_VERSION} | ||
|
||
# Install required tools and libraries | ||
RUN apt-get -yqq update && \ | ||
apt-get -yqq install --no-install-recommends \ | ||
curl unzip gnupg wget libglib2.0-0 libx11-6 libnss3 \ | ||
libgdk-pixbuf2.0-0 libx11-xcb1 libxcomposite1 libxrandr2 \ | ||
libasound2 libatk-bridge2.0-0 libatk1.0-0 libcups2 libdrm2 \ | ||
fonts-liberation libappindicator3-1 libnspr4 libnss3 libxss1 \ | ||
libgbm1 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Chrome WebDriver | ||
RUN mkdir -p /opt/chromedriver-${CHROMEDRIVER_VERSION} && \ | ||
curl -sS -o /tmp/chromedriver_linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip && \ | ||
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-${CHROMEDRIVER_VERSION} && \ | ||
rm /tmp/chromedriver_linux64.zip && \ | ||
chmod +x /opt/chromedriver-${CHROMEDRIVER_VERSION}/chromedriver-linux64/chromedriver && \ | ||
ln -fs /opt/chromedriver-${CHROMEDRIVER_VERSION}/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver | ||
|
||
# Install Google Chrome version 131.0.6778.85 | ||
RUN curl -sS -o /tmp/chrome-linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip && \ | ||
unzip -qq /tmp/chrome-linux64.zip -d /opt/google-chrome-${CHROME_VERSION} && \ | ||
rm /tmp/chrome-linux64.zip && \ | ||
ln -fs /opt/google-chrome-${CHROME_VERSION}/chrome-linux64/chrome /usr/local/bin/google-chrome-stable | ||
|
||
# Set pip to use Tsinghua University mirror | ||
RUN mkdir -p /etc/pip.conf && \ | ||
echo "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /etc/pip.conf | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
COPY app /app | ||
|
||
# Install Python dependencies | ||
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir selenium | ||
|
||
# Set container to idle on start (or modify to start your application) | ||
CMD ["tail", "-f", "/dev/null"] |