forked from mozilla/klaatu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.desktop
123 lines (95 loc) · 4.13 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
# 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 ubuntu:mantic 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 ubuntu:mantic
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 \
ca-certificates \
curl \
firefox \
python3-pip \
python3-setuptools \
python3-wheel \
sudo \
wget \
build-essential \
gcc \
python3 \
tox \
pipx \
libgtk-3-dev \
libasound2 \
libdbus-glib-1-dev \
xvfb \
libgl1-mesa-dri \
' \
&& 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.tar.bz2 $FIREFOX_DOWNLOAD_URL \
&& rm -rf /opt/firefox \
&& tar -C /opt -xjf /tmp/firefox.tar.bz2 \
&& rm /tmp/firefox.tar.bz2 \
&& 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
# Download older firefox nightly
RUN FIREFOX_OLD_DOWNLOAD_URL=$(python3 utilities/download_old_firefox.py) \
&& wget -q -O /tmp/firefox_old.tar.bz2 $FIREFOX_OLD_DOWNLOAD_URL \
&& mkdir utilities/firefox-old-nightly \
&& mkdir utilities/firefox-old-nightly-disable-test \
&& tar -C utilities/firefox-old-nightly -xjf /tmp/firefox_old.tar.bz2 \
&& tar -C utilities/firefox-old-nightly-disable-test -xjf /tmp/firefox_old.tar.bz2 \
&& rm /tmp/firefox_old.tar.bz2
# 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"]