1- # ## IMPORTANT DOCKER COMMANDS ###
1+ FROM ubuntu as production
22
3- # ## docker images - List images available
4- # ## docker build <GITHUB-REPO-LINK> -t TAGNAME - Builds the Dockerfile from the github repo
5- # ## docker ps - List running images
6- # ## docker stop <IMAGE ID || IMAGE NAME> - Stops running image with either --name <IMAGE NAME> || IMAGE ID>
7- # ## docker run -it -d TAGNAME /bin/bash - Runs bash
8- # ## docker exec -it <IMAGE ID> /bin/bash - Connects to bash for terminal execution (Needs to be running first)
3+ # since we don't really need a stable base we can also upgrade
4+ RUN apt update && apt upgrade -y
95
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-
15- # ## INSTALLING METHOD ###
16-
17- # ## Recommend to install with "docker build <GITHUB-REPO-LINK> -t TAGNAME",
18- # ## grabs the latest copy of WPT and build time on average takes 10 minutes.
19-
20- FROM ubuntu
21-
22- # ## PREVENTs INTERACTIVE PROMPTS WHILE INSTALLING ###
23- ARG DEBIAN_FRONTEND=noninteractive
24-
25- # ## COPYING ENTIRE DIR TO LOCAL DOCKER /wptagent
6+ # Get files
7+ # see .dockerignore for filterd out folders
268COPY / /wptagent
27- RUN apt-get update
289
29- # Git Clone Install
30- # RUN apt-get install -y git
31- # RUN git clone -b dockerfile https://github.com/sammeboy635/wptagent.git
10+ # dependencies
3211
33- # ## UPDATE ###
34- RUN apt-get update
12+ # # apt dependencies (took them from https://github.com/WPO-Foundation/wptagent/blob/master/.github/workflows/wptagent_test.yml#L31)
13+ # split into 2 parts to show dependency gathered from docs and found during upgrade of the docker image
14+ # set UTC as default timezone before end to avoid user interaction for tzdata package
15+ RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
16+ DEBIAN_FRONTEND=noninteractive apt install -y pylint apt-transport-https xserver-xorg-video-dummy xvfb gnupg2 python3-ujson imagemagick \
17+ dbus-x11 traceroute software-properties-common psmisc libnss3-tools iproute2 net-tools openvpn libtiff5-dev \
18+ libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk python3-dev \
19+ libavutil-dev libmp3lame-dev libx264-dev yasm autoconf automake build-essential libass-dev libfreetype6-dev \
20+ libtheora-dev libtool libvorbis-dev pkg-config texi2html libtext-unidecode-perl python3-numpy python3-scipy \
21+ perl adb ethtool nodejs cmake libsdl2-dev libva-dev libvdpau-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
22+ texinfo wget ttf-mscorefonts-installer fonts-noto fonts-roboto fonts-open-sans
23+ RUN apt install -y python3 python3-pip curl npm sudo
3524
36- # ## INSTALL APT-GET LIBS ###
37- RUN xargs -a /wptagent/.github/workflows/docker-apt-get.txt apt-get install --no-install-recommends --yes; exit 0
3825
39- # ## UPGRADING PIP AND INSTALLING REQUIRED PACKAGES ###
40- RUN python3 -m pip install --upgrade --user pip && \
41- python3 -m pip install --user - r /wptagent/.github/workflows/requirements.txt
26+ # # python dependencies
27+ # FIXME split requirements into dev requirements and release requirements
28+ RUN pip install -r /wptagent/.github/workflows/requirements.txt && rm -rf /wptagent/.github/
4229
43- # ## INSTALLING LIGHTHOUSE FROM NPM ###
30+ # # npm dependencies
4431RUN npm install -g lighthouse
4532
46- # ## INSTALLING CHROME BROWSER ###
47- # ## Fails to Find all libs needed to run
48- # RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
49- # dpkg -i google-chrome-stable_current_amd64.deb; exit 0 && \
50- # apt -f install -y && \
51- # apt-get install google-chrome-stable
33+ # install chrome, simplified version
34+ RUN curl -o google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
35+ apt install -y /google-chrome-stable_current_amd64.deb && rm /google-chrome-stable_current_amd64.deb
5236
53- # ## BETTER INSTALLING CHROME BROWSER METHOD ###
54- # ## Better Installing method but would like to change this to something less complex.
55- RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
56- && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
57- RUN apt-get update && apt-get -y install google-chrome-stable ; exit 0
58- RUN apt-get update --fix-missing -y
59- RUN apt-get install -f -y
37+ WORKDIR /wptagent
6038
61- # ## CLEAN UP ###
62- # We could add some clean up here but in testing it was negotiable
39+ ENTRYPOINT ["/bin/sh" , "/wptagent/docker/linux-headless/entrypoint.sh" ]
6340
41+ # Create debug build that waits for a debugger to attach
42+ FROM production as debug
6443
65- WORKDIR /wptagent
44+ RUN pip install debugpy
45+
46+ RUN mv wptagent.py wptagent_starter.py
47+
48+ COPY wptagent_debug.py wptagent.py
6649
67- # ## /bin/bash LOCATION OF COMMAND EXECUTION ###
68- CMD [ "/bin/bash" , "/wptagent/docker/linux-headless/entrypoint.sh" ]
50+ # set production build as default
51+ FROM production
0 commit comments