77# ## docker run -it -d TAGNAME /bin/bash - Runs bash
88# ## docker exec -it <IMAGE ID> /bin/bash - Connects to bash for terminal execution (Needs to be running first)
99
10- # ## EXAMPLE DOCKER COMMANDS FOR RUNNING SERVER & AGENT
11-
12- # ## docker run -d -p 4000:80 <IMAGE ID || <IMAGE TAG>
13- # ## docker run -d -p 4001:80 --network="host" -e "SERVER_URL=http://localhost:4000/work/" -e "LOCATION=Test" -e "-v" <IMAGE ID || <IMAGE TAG>
14-
1510# ## INSTALLING METHOD ###
1611
1712# ## Recommend to install with "docker build <GITHUB-REPO-LINK> -t TAGNAME",
1813# ## grabs the latest copy of WPT and build time on average takes 10 minutes.
1914
20- FROM ubuntu:22.04
21-
22- # ## PREVENTs INTERACTIVE PROMPTS WHILE INSTALLING ###
23- ARG DEBIAN_FRONTEND=noninteractive
24-
25- # ## COPYING ENTIRE DIR TO LOCAL DOCKER /wptagent
26- COPY / /wptagent
27- RUN apt-get update
15+ FROM ubuntu:22.04 as production
2816
29- # Git Clone Install
30- # RUN apt-get install -y git
31- # RUN git clone -b dockerfile https://github.com/sammeboy635/wptagent.git
32-
33- RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
17+ # ## TIMEZONE INSIDE THE CONTAINER ###
18+ ARG TIMEZONE=UTC
3419
3520# ## UPDATE ###
36- RUN apt-get update
21+ RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
22+ RUN apt update
3723
3824# ## INSTALL APT-GET LIBS ###
39- RUN apt-get install -y \
25+ # DEBIAN_FRONTEND prevents interactive prompts while installing
26+ # set default timezone beforehand to avoid user interaction for tzdata package
27+ RUN ln -fs /usr/share/zoneinfo/$TIMEZONE /etc/localtime && DEBIAN_FRONTEND=noninteractive apt install -y \
4028 python3 python3-pip python3-ujson \
4129 imagemagick dbus-x11 traceroute software-properties-common psmisc libnss3-tools iproute2 net-tools openvpn \
4230 libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
4331 python3-dev libavutil-dev libmp3lame-dev libx264-dev yasm autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev \
4432 libtool libvorbis-dev pkg-config texi2html libtext-unidecode-perl python3-numpy python3-scipy perl \
4533 adb ethtool nodejs cmake git-core libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev texinfo wget \
46- ttf-mscorefonts-installer fonts-noto fonts-roboto fonts-open-sans ffmpeg npm
34+ ttf-mscorefonts-installer fonts-noto fonts-roboto fonts-open-sans ffmpeg npm sudo curl xvfb
4735
48- # ## Update the font cache
36+ # ## UPDATE FONT CACHE ###
4937RUN fc-cache -f -v
5038
51- # ## UPGRADING PIP AND INSTALLING REQUIRED PACKAGES ###
52- RUN python3 -m pip install --upgrade --user pip && \
53- python3 -m pip install --user -r /wptagent/.github/workflows/requirements.txt
54-
5539# ## INSTALLING LIGHTHOUSE FROM NPM ###
5640RUN npm install -g lighthouse
5741
5842# ## INSTALLING CHROME BROWSER ###
59- # ## Fails to Find all libs needed to run
60- # RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
61- # dpkg -i google-chrome-stable_current_amd64.deb; exit 0 && \
62- # apt -f install -y && \
63- # apt-get install google-chrome-stable
43+ RUN curl -o /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
44+ apt install -y /tmp/google-chrome-stable_current_amd64.deb && rm /tmp/google-chrome-stable_current_amd64.deb
6445
65- # ## BETTER INSTALLING CHROME BROWSER METHOD ###
66- # ## Better Installing method but would like to change this to something less complex.
67- RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
68- && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
69- RUN apt-get update && apt-get -y install google-chrome-stable ; exit 0
70- RUN apt-get update --fix-missing -y
71- RUN apt-get install -f -y
46+ # ## UPGRADING PIP AND INSTALLING REQUIRED PACKAGES ###
47+ COPY /.github/workflows/requirements.txt /tmp/agent_requirements.txt
48+ RUN python3 -m pip install --upgrade --user pip && \
49+ python3 -m pip install --user -r /tmp/agent_requirements.txt && \
50+ rm /tmp/agent_requirements.txt
7251
73- # ## CLEAN UP ###
74- # We could add some clean up here but in testing it was negotiable
52+ # ## COPYING ENTIRE DIR TO LOCAL DOCKER /wptagent ###
53+ # see .dockerignore for filterd out folders
54+ # source copy last so we don't need to rebuild all the other layers
55+ COPY / /wptagent
56+ WORKDIR /wptagent
7557
58+ ENTRYPOINT ["/bin/sh" , "/wptagent/docker/linux-headless/entrypoint.sh" ]
7659
77- WORKDIR /wptagent
60+ # ## DEBUG CONTAINER ###
61+ FROM production as debug
62+
63+ # ## INSTALLING DEBUG DEPENDENCIES ###
64+ RUN pip install debugpy
65+
66+ # ## COPY DEBUG AGENT AND MOVE REAL ONE ###
67+ RUN mv wptagent.py wptagent_starter.py
68+ COPY wptagent_debug.py wptagent.py
7869
79- # ## /bin/bash LOCATION OF COMMAND EXECUTION ###
80- CMD [ "/bin/bash" , "/wptagent/docker/linux-headless/entrypoint.sh" ]
70+ # ## SETTING PRODUCTION BUILD AS DEFAULT ###
71+ FROM production
0 commit comments