Created
February 7, 2024 15:34
-
-
Save gmetais/81ea80f4579baea17060d70d8eafaea9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FROM ubuntu:18.04 | |
LABEL author="[email protected]" | |
# Default versions for Chrome Stable and Lighthouse | |
# | |
# Can be overidden at build time e.g. docker build --build-arg LIGHTHOUSE_VERSION=8.5.1 | |
# | |
# Stable Chrome versions https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable | |
# | |
# Firefox versions: https://download-installer.cdn.mozilla.net/pub/firefox/releases/ | |
# | |
ARG CHROME_STABLE_VERSION=107.0.5304.87-1 | |
ARG FIREFOX_STABLE_VERSION=105.0 | |
ARG LIGHTHOUSE_VERSION=9.6.7 | |
ARG NODEJS_VERSION=16.x | |
# Default Timeszone | |
# | |
# TODO Is there are better way to do this as most customers won't be in this tz? | |
# Maybe just keep it as UTC? | |
# | |
ENV TZ=Europe/London | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
RUN apt-get update && \ | |
apt-get install -y \ | |
wget \ | |
curl \ | |
git \ | |
python \ | |
python-pip \ | |
python-ujson \ | |
xvfb \ | |
sudo | |
RUN apt-get install -y \ | |
python-dev \ | |
zlib1g-dev \ | |
libjpeg-dev \ | |
psmisc \ | |
dbus-x11 \ | |
sudo \ | |
kmod | |
RUN apt-get install -y \ | |
net-tools \ | |
tcpdump \ | |
traceroute \ | |
bind9utils \ | |
libnss3-tools \ | |
iproute2 \ | |
software-properties-common \ | |
nano | |
# gpg-agent \ | |
# python-setuptools \ | |
# gcc && \ | |
# Node setup | |
# Node | |
RUN curl -sL https://deb.nodesource.com/setup_${NODEJS_VERSION} | sudo -E bash - | |
# Install browsers | |
# Chrome | |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ | |
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \ | |
# Chrome stable has to be manually downloaded and installed (only latest stable version is available via apt-get) | |
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_STABLE_VERSION} | |
_amd64.deb | |
RUN apt install -y /tmp/chrome.deb && \ | |
rm /tmp/chrome.deb | |
RUN apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | |
firefox-geckodriver \ | |
nodejs | |
# apt-get update && \ | |
# add-apt-repository -y ppa:ubuntu-mozilla-daily/ppa && \ | |
# DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | |
# google-chrome-beta \ | |
# google-chrome-unstable \ | |
# Firefox | |
# firefox \ | |
# firefox-trunk \ | |
RUN apt-get install -y \ | |
imagemagick | |
RUN apt-get install -y \ | |
ffmpeg | |
# Get fonts | |
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections && \ | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install ttf-mscorefonts-installer fonts-noto* && \ | |
sudo fc-cache -f -v | |
# Cleaup to save space in layer | |
RUN sudo apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install lighthouse | |
RUN npm config set registry http://r.cnpmjs.org && \ | |
npm install -g lighthouse@${LIGHTHOUSE_VERSION} | |
# Install other utilities | |
RUN pip install --timeout 10000 -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir \ | |
dnspython \ | |
monotonic \ | |
pillow \ | |
psutil \ | |
requests \ | |
tornado \ | |
'wsaccel==0.6.3' \ | |
xvfbwrapper \ | |
brotli \ | |
'fonttools>=3.44.0,<4.0.0' \ | |
'mozrunner==7.4.0' \ | |
'mozfile==2.1.0' \ | |
marionette_driver \ | |
selenium \ | |
future | |
COPY ./wptagent.py /wptagent/wptagent.py | |
COPY ./internal /wptagent/internal | |
COPY ./ws4py /wptagent/ws4py | |
COPY ./docker/linux-headless/entrypoint.sh /wptagent/entrypoint.sh | |
WORKDIR /wptagent | |
CMD ["/bin/bash", "/wptagent/entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment