SeleniumBase/Dockerfile

139 lines
3.7 KiB
Docker
Raw Normal View History

2015-12-05 05:11:53 +08:00
# SeleniumBase Docker Image
2024-04-14 23:56:43 +08:00
FROM ubuntu:22.04
2024-06-28 12:01:10 +08:00
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
2024-08-01 02:39:10 +08:00
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
2024-06-28 12:01:10 +08:00
#======================
# Locale Configuration
#======================
RUN apt-get update
RUN apt-get install -y --no-install-recommends tzdata locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
2024-08-01 02:39:10 +08:00
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "LANG=en_US.UTF-8" > /etc/locale.conf
RUN locale-gen en_US.UTF-8
2024-06-28 12:01:10 +08:00
#======================
# Install Common Fonts
#======================
RUN apt-get update
RUN apt-get install -y \
fonts-liberation \
2024-08-01 02:39:10 +08:00
fonts-liberation2 \
fonts-font-awesome \
fonts-ubuntu \
fonts-terminus \
fonts-powerline \
2024-06-28 12:01:10 +08:00
fonts-open-sans \
fonts-mononoki \
fonts-roboto \
fonts-lato
2015-12-05 05:11:53 +08:00
2024-04-14 23:56:43 +08:00
#============================
# Install Linux Dependencies
#============================
2024-06-28 12:01:10 +08:00
RUN apt-get update
RUN apt-get install -y \
2024-04-14 23:56:43 +08:00
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libatspi2.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnspr4 \
libnss3 \
2024-06-28 12:01:10 +08:00
libu2f-udev \
libvulkan1 \
2024-04-14 23:56:43 +08:00
libwayland-client0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxkbcommon0 \
2024-06-28 12:01:10 +08:00
libxrandr2
#==========================
# Install useful utilities
#==========================
RUN apt-get update
2024-08-01 02:39:10 +08:00
RUN apt-get install -y xdg-utils ca-certificates
2015-12-05 05:11:53 +08:00
2016-01-21 02:37:58 +08:00
#=================================
# Install Bash Command Line Tools
#=================================
2024-06-28 12:01:10 +08:00
RUN apt-get update
2016-01-21 02:37:58 +08:00
RUN apt-get -qy --no-install-recommends install \
2024-04-16 00:42:13 +08:00
curl \
2015-12-05 05:11:53 +08:00
sudo \
unzip \
vim \
2024-04-16 00:42:13 +08:00
wget \
2024-06-28 12:01:10 +08:00
xvfb
2016-01-21 02:37:58 +08:00
2016-01-12 12:11:37 +08:00
#================
# Install Chrome
#================
2024-06-28 12:01:10 +08:00
RUN apt-get update
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
2024-08-01 02:39:10 +08:00
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
RUN rm ./google-chrome-stable_current_amd64.deb
2016-01-12 12:11:37 +08:00
2024-04-16 00:42:13 +08:00
#================
# Install Python
#================
2024-06-28 12:01:10 +08:00
RUN apt-get update
RUN apt-get install -y python3 python3-pip python3-setuptools python3-dev python3-tk
2024-04-14 23:56:43 +08:00
RUN alias python=python3
RUN echo "alias python=python3" >> ~/.bashrc
RUN apt-get -qy --no-install-recommends install python3.10
2021-01-30 15:36:20 +08:00
RUN rm /usr/bin/python3
2024-04-14 23:56:43 +08:00
RUN ln -s python3.10 /usr/bin/python3
2021-01-30 15:36:20 +08:00
2024-06-28 12:01:10 +08:00
#===============
# Cleanup Lists
#===============
2024-08-01 02:39:10 +08:00
RUN apt-get clean
2024-06-28 12:01:10 +08:00
RUN rm -rf /var/lib/apt/lists/*
2024-04-16 00:42:13 +08:00
2015-12-05 05:11:53 +08:00
#=====================
# Set up SeleniumBase
#=====================
COPY sbase /SeleniumBase/sbase/
2015-12-05 05:11:53 +08:00
COPY seleniumbase /SeleniumBase/seleniumbase/
COPY examples /SeleniumBase/examples/
2018-07-27 03:28:50 +08:00
COPY integrations /SeleniumBase/integrations/
COPY requirements.txt /SeleniumBase/requirements.txt
COPY setup.py /SeleniumBase/setup.py
2024-04-16 00:42:13 +08:00
COPY MANIFEST.in /SeleniumBase/MANIFEST.in
COPY pytest.ini /SeleniumBase/pytest.ini
COPY setup.cfg /SeleniumBase/setup.cfg
COPY virtualenv_install.sh /SeleniumBase/virtualenv_install.sh
2021-06-05 09:52:34 +08:00
RUN find . -name '*.pyc' -delete
2024-04-16 00:42:13 +08:00
RUN pip install --upgrade pip setuptools wheel
RUN cd /SeleniumBase && ls && pip install -r requirements.txt --upgrade
RUN cd /SeleniumBase && pip install .
2024-06-28 12:01:10 +08:00
RUN pip install pyautogui
2021-07-12 13:11:26 +08:00
2024-04-14 23:56:43 +08:00
#=======================
# Download chromedriver
#=======================
2024-04-16 00:42:13 +08:00
RUN seleniumbase get chromedriver --path
2015-12-05 05:11:53 +08:00
2016-01-21 02:37:58 +08:00
#==========================================
# Create entrypoint and grab example tests
#==========================================
COPY integrations/docker/docker-entrypoint.sh /
COPY integrations/docker/run_docker_test_in_chrome.sh /
2017-07-18 12:46:15 +08:00
RUN chmod +x *.sh
2015-12-05 05:11:53 +08:00
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/bin/bash"]