Repository navigation
Expand file tree
/
Copy pathdocker-compose.selenium-chrome.yaml
More file actions
73 lines (73 loc) · 3.17 KB
/
Copy pathdocker-compose.selenium-chrome.yaml
File metadata and controls
73 lines (73 loc) · 3.17 KB
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
#ddev-generated
# Remove the line above if you don't want this file to be overwritten when you run
# ddev get ddev/ddev-selenium-standalone-chrome
#
# This file comes from https://github.com/ddev/ddev-selenium-standalone-chrome
#
services:
selenium-chrome:
image: ${SELENIUM_CHROME_DOCKER_IMAGE:-selenium/standalone-chromium:155.0}-${DDEV_SITENAME}-built
build:
# The upstream image runs as "seluser" (uid 1200). Turn that user into
# the host user (same name, uid and gid) so files the browser reads or
# writes in the mounted project have the right ownership.
# The home directory stays /home/seluser, which the image expects.
dockerfile_inline: |
ARG SELENIUM_CHROME_DOCKER_IMAGE="scratch"
FROM $${SELENIUM_CHROME_DOCKER_IMAGE}
USER root
ARG username
ARG uid
ARG gid
RUN set -eu; \
old_uid="$$(id -u seluser)"; old_gid="$$(id -g seluser)"; \
for u in "$$(getent passwd "$${uid}" | cut -d: -f1)" "$$(getent passwd "$${username}" | cut -d: -f1)"; do \
if [ -n "$${u}" ] && [ "$${u}" != "seluser" ]; then userdel "$${u}"; fi; \
done; \
for g in "$$(getent group "$${gid}" | cut -d: -f1)" "$$(getent group "$${username}" | cut -d: -f1)"; do \
if [ -n "$${g}" ] && [ "$${g}" != "seluser" ]; then groupdel "$${g}" || true; fi; \
done; \
groupmod -o -g "$${gid}" seluser; \
if ! getent group "$${username}" >/dev/null; then groupmod -n "$${username}" seluser; fi; \
usermod -o -u "$${uid}" -g "$${gid}" seluser; \
if [ "$${username}" != "seluser" ]; then usermod -l "$${username}" seluser; fi; \
find / -xdev -uid "$${old_uid}" -exec chown -h "$${uid}" {} +; \
find / -xdev -gid "$${old_gid}" -exec chgrp -h "$${gid}" {} +
USER $${uid}:$${gid}
args:
SELENIUM_CHROME_DOCKER_IMAGE: ${SELENIUM_CHROME_DOCKER_IMAGE:-selenium/standalone-chromium:155.0}
username: ${DDEV_USER}
uid: ${DDEV_UID}
gid: ${DDEV_GID}
container_name: ddev-${DDEV_SITENAME}-selenium-chrome
hostname: ${DDEV_SITENAME}-selenium-chrome
user: "${DDEV_UID}:${DDEV_GID}"
restart: "no"
expose:
# The internal noVNC port, which operates over HTTP so it can be exposed
# through the router.
- 7900
environment:
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTPS_EXPOSE=7900:7900
- HTTP_EXPOSE=7910:7900
- VNC_NO_PASSWORD=1
# Enables multiple parallel connections to the Selenium.
- SE_NODE_MAX_SESSIONS=12
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
# To enable VNC access for traditional VNC clients like macOS "Screen Sharing",
# uncomment the following two lines.
#ports:
# - "5900:5900"
volumes:
# To enable file uploads in E2E tests.
- "../:/var/www/html"
- ".:/mnt/ddev_config"
# Provides mkcert/rootCA.pem to the post-start hook in
# config.selenium-standalone-chrome.yaml.
- "ddev-global-cache:/mnt/ddev-global-cache"
x-ddev:
ssh-shell: bash
describe-info: |
WebDriver: http://selenium-chrome:4444/wd/hub
Watch tests (noVNC): ddev launch :7900