-
Notifications
You must be signed in to change notification settings - Fork 290
/
Copy pathdocker-selenium.yaml
186 lines (172 loc) · 6.22 KB
/
docker-selenium.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package:
name: docker-selenium
# Officially they distribute the version with the following format: 4.16.1-20231219
# But the '-' is not a valid character according to APK versioning spec; and resulting
# 'package format error' when trying to install the package. The workaround is
# to replace '-' with '.', then mangling the version to replace back.
version: 4.18.1.20240224
epoch: 1
description: Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
copyright:
- license: Apache-2.0
target-architecture:
# TODO: Enable aarch64
# Requires aarch64 variant of Chromedriver
- x86_64
dependencies:
runtime:
- Xvfb
- bash
- busybox
- chromium
- chromium-docker-selenium-compat
- coreutils
- fluxbox
- font-ipa
- font-liberation
- font-misc-cyrillic
- font-noto-emoji
- font-ubuntu
- font-wqy-zenhei
- fontconfig
- freetype
- glib
- glibc-locale-en
- libfontconfig1
- libgcc
- libnss
- libnss-tools
- libxcb
- mcookie
- novnc
- openjdk-11
- pulseaudio
- selenium-server-compat
- sudo-rs
- supervisor
- ttf-dejavu
- tzdata
- websockify
- x11vnc
- xauth
- xkbcomp
- xkeyboard-config
- xmessage
- xvfb-run
environment:
contents:
packages:
- acl
- bash
- build-base
- busybox
- bzip2
- ca-certificates-bundle
- curl
- git
- gnupg
- jq
- openjdk-11
- openjdk-11-default-jvm
- openjdk-11-jre
- openssl
- x11vnc
- yq
environment:
JAVA_HOME: /usr/lib/jvm/java-11-openjdk
TC: UTC
SEL_USER: seluser
SEL_PASSWD: secret
# Transform melange version to replace last dot "." with "-".
var-transforms:
- from: ${{package.version}}
match: ^(.+)\.(\d+)$
replace: $1-$2
to: mangled-package-version
pipeline:
- uses: git-checkout
with:
repository: https://github.com/SeleniumHQ/docker-selenium
tag: ${{vars.mangled-package-version}}
expected-commit: 9e99f2adf126979fe4a79ded70ff57e8da889ae3
- uses: patch
with:
patches: 0001-fix-paths.patch
- runs: |
mkdir -p ${{targets.destdir}}/usr/bin
mkdir -p ${{targets.destdir}}/etc/supervisor/conf.d
mkdir -p ${{targets.destdir}}/var/tmp
# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/Base/Dockerfile
- working-directory: Base
pipeline:
- runs: |
mkdir -p ${{targets.destdir}}/opt/bin
install -Dm755 check-grid.sh ${{targets.destdir}}/opt/bin/
install -Dm755 entry_point.sh ${{targets.destdir}}/opt/bin/
install -Dm755f supervisord.conf ${{targets.destdir}}/etc
mkdir -p ${{targets.destdir}}/var/run/supervisor
- runs: |
mkdir -p ${{targets.destdir}}/opt/selenium
echo "${SEL_PASSWD}" > ${{targets.destdir}}/opt/selenium/initialPasswd
# TODO: Implement malware scan for jars retrieved by coursier
- runs: |
# Retrieve OpenTelemetry/GRPC Java versions
export OPENTELEMETRY_VERSION=$(curl "https://api.github.com/repos/open-telemetry/opentelemetry-java/releases/latest" | jq -r ".tag_name" | sed 's/v//')
export GRPC_VERSION=$(curl "https://api.github.com/repos/grpc/grpc-java/releases/latest" | jq -r ".tag_name" | sed 's/v//')
mkdir -p ${{targets.destdir}}/external_jars
curl -sSLfO https://github.com/coursier/launchers/raw/master/coursier
chmod +x coursier
./coursier fetch --classpath --cache ${{targets.destdir}}/external_jars \
io.opentelemetry:opentelemetry-exporter-otlp:${OPENTELEMETRY_VERSION} \
io.grpc:grpc-netty:${GRPC_VERSION} > ${{targets.destdir}}/external_jars/.classpath.txt
# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/NodeBase/Dockerfile
- working-directory: NodeBase
pipeline:
- runs: |
install -Dm755 start-selenium-node.sh ${{targets.destdir}}/opt/bin/
install -Dm755 start-xvfb.sh ${{targets.destdir}}/opt/bin/
install -Dm755 selenium.conf ${{targets.destdir}}/etc/supervisor/conf.d/
install -Dm755 start-vnc.sh ${{targets.destdir}}/opt/bin/
install -Dm755 start-novnc.sh ${{targets.destdir}}/opt/bin/
install -Dm755 selenium_grid_logo.png ${{targets.destdir}}/usr/share/images/fluxbox/ubuntu-light.png
install -Dm755 generate_config ${{targets.destdir}}/opt/bin/generate_config
mkdir -p ${{targets.destdir}}/home/$SEL_USER/.fluxbox
mkdir -p ${{targets.destdir}}/tmp/.X11-unix
mkdir -p ${{targets.destdir}}/home/$SEL_USER/.vnc
mkdir -p ${{targets.destdir}}/opt/selenium
x11vnc -storepasswd $(cat ${{targets.destdir}}/opt/selenium/initialPasswd) ${{targets.destdir}}/home/$SEL_USER/.vnc/passwd
# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/NodeChrome/Dockerfile
- working-directory: NodeChrome
pipeline:
- runs: |
install -Dm755 wrap_chrome_binary ${{targets.destdir}}/opt/bin/wrap_chrome_binary
# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/Standalone/Dockerfile
- working-directory: Standalone
pipeline:
- runs: |
install -Dm755 start-selenium-standalone.sh ${{targets.destdir}}/opt/bin/start-selenium-standalone.sh
install -Dm755 selenium.conf ${{targets.destdir}}/etc/supervisor/conf.d/
install -Dm755 generate_config ${{targets.destdir}}/opt/bin/generate_config
- uses: strip
subpackages:
- name: docker-selenium-supervisor-config
description: Docker Selenium supervisor configuration
dependencies:
replaces:
- supervisor-config
provides:
- supervisor-config
pipeline:
- runs: |
mkdir -p ${{targets.subpkgdir}}/etc
mv ${{targets.destdir}}/etc/supervisord.conf ${{targets.subpkgdir}}/etc
mv ${{targets.destdir}}/etc/supervisor ${{targets.subpkgdir}}/etc
update:
enabled: true
ignore-regex-patterns:
- '.*grid.*'
version-transform:
- match: ^(.+)\-(\d+)$
replace: $1.$2
github:
identifier: SeleniumHQ/docker-selenium