-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.desktop
133 lines (105 loc) · 4.17 KB
/
Dockerfile.desktop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
FROM python:3.12-slim as moz-central
RUN apt-get -qq update && apt-get -qq install -y git
RUN git clone https://github.com/mozilla/gecko-dev.git --depth 1
FROM python:3.12-slim
USER root
ARG RESOLUTION="1920x1080x24"
ARG XARGS=""
ARG FIREFOX_VERSION=""
# Set env
ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
GECKODRIVER_VERSION=0.34.0 \
XVFB_RES="${RESOLUTION}" \
XVFB_ARGS="${XARGS}"
# Install requirements to install tools
RUN dependencies=' \
bzip2 \
curl \
gcc \
gnupg2 \
libasound2 \
libatspi2.0-0 \
libdbus-glib-1-2 \
libdrm2 \
libfontconfig1 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libgbm1 \
libglib2.0-0 \
libgtk-3-0 \
libgconf-2-4 \
libnss3 \
libxt6 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrender1 \
libxext6 \
libxrandr2 \
musl-dev \
wget \
xauth \
xvfb \
xz-utils \
' \
&& set -x \
&& apt-get -qq update && apt-get -qq install -y software-properties-common \
&& apt-get -qq update && apt-get -qq install --no-install-recommends -y $dependencies \
&& apt-get -y purge firefox \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy all files to the container
COPY . /code
WORKDIR /code
# Download Firefox
ARG FIREFOX_DOWNLOAD_URL=https://download.mozilla.org/?product=firefox${FIREFOX_VERSION}-latest-ssl&lang=en-US&os=linux64
RUN wget --no-verbose -O /tmp/firefox $FIREFOX_DOWNLOAD_URL \
&& rm -rf /opt/firefox \
&& tar -C /opt -xf /tmp/firefox \
&& rm /tmp/firefox \
&& ln -fs /opt/firefox/firefox /usr/bin/firefox
# @hackebrot
ARG GECKODRIVER_DOWNLOAD_URL=https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz
RUN rm -rf /opt/geckodriver \
&& wget --no-verbose -O /tmp/geckodriver.tar.gz $GECKODRIVER_DOWNLOAD_URL \
&& tar -C /opt -zxf /tmp/geckodriver.tar.gz \
&& rm /tmp/geckodriver.tar.gz \
&& mv /opt/geckodriver /opt/geckodriver-$GECKODRIVER_VERSION \
&& chmod 755 /opt/geckodriver-$GECKODRIVER_VERSION \
&& ln -fs /opt/geckodriver-$GECKODRIVER_VERSION /usr/bin/geckodriver
RUN mv /usr/bin/geckodriver /usr/bin/geckodriver2 \
&& mv ./utilities/geckodriver /usr/bin/geckodriver \
&& chmod +x /usr/bin/geckodriver
# Install python deps
RUN pip install poetry \
&& poetry install --no-root
# Download older firefox nightly
RUN FIREFOX_OLD_DOWNLOAD_URL=$(python3 utilities/download_old_firefox.py) \
&& wget -q -O /tmp/firefox_old $FIREFOX_OLD_DOWNLOAD_URL \
&& mkdir utilities/firefox-old-nightly \
&& mkdir utilities/firefox-old-nightly-disable-test \
&& tar -C utilities/firefox-old-nightly -xf /tmp/firefox_old \
&& tar -C utilities/firefox-old-nightly-disable-test -xf /tmp/firefox_old \
&& rm /tmp/firefox_old
# Create profile used for update tests
RUN utilities/firefox-old-nightly/firefox/firefox -CreateProfile -headless "klaatu-profile-old-base /code/utilities/klaatu-profile-old-base"
RUN utilities/firefox-old-nightly-disable-test/firefox/firefox -CreateProfile -headless "klaatu-profile-disable-test /code/utilities/klaatu-profile-disable-test"
RUN firefox -CreateProfile -headless "klaatu-profile-firefox-base /code/utilities/klaatu-profile-firefox-base"
RUN firefox -CreateProfile -headless "klaatu-profile-current-base /code/utilities/klaatu-profile-current-base"
# Copy prefs needed for test
RUN cp utilities/user.js utilities/klaatu-profile-old-base
RUN cp utilities/user.js utilities/klaatu-profile-current-base
RUN cp utilities/user.js utilities/klaatu-profile-disable-test
RUN cp utilities/user.js utilities/klaatu-profile-firefox-base
COPY --from=moz-central gecko-dev/browser/components/search/test/browser/telemetry/ /code/search_files/
RUN mv search_server/* search_files/
RUN sed -i 's/\r$//' xvfb-startup.sh
ENTRYPOINT ["/bin/bash", "xvfb-startup.sh"]