Hashar has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394340 )

Change subject: npm-browser with stretch
......................................................................

npm-browser with stretch

Bring in Chromium, Firefox-esr (v52) and PhantomJS in a stretch
container.

When using Karma, developers usually set the browser to "Chrome" which
is not available in Debian Jessie.  Trick the karma-launcher-chrome into
thinking Chromium is Chrome by setting CHROME_BIN=/usr/bin/chromium

Chromium attempts to create namespaces (sandboxing) which is not
permitted by Docker unless a container is running in privileged mode.
Thus ask Chromium to disable the sandboxing feature via:
   CHROMIUM_FLAGS="--no-sandbox"

That is recognized by the /usr/bin/chromium shell wrapper.

Firefox insists on creating dummy files in ~/.mozilla, however we run as
user nobody with HOME=/nonexistent (a non existent directory). Provide a
wrapper to point to /tmp/firefox.
https://github.com/karma-runner/karma-firefox-launcher/issues/28

Bug: T179360
Change-Id: I0f24bb3a2bd6602424241d62c0b0f1de68e286cf
---
A dockerfiles/npm-browser-test-stretch/.dockerignore
A dockerfiles/npm-browser-test-stretch/Dockerfile
A dockerfiles/npm-browser-test-stretch/example-run.sh
3 files changed, 54 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/40/394340/1

diff --git a/dockerfiles/npm-browser-test-stretch/.dockerignore 
b/dockerfiles/npm-browser-test-stretch/.dockerignore
new file mode 100644
index 0000000..139ce78
--- /dev/null
+++ b/dockerfiles/npm-browser-test-stretch/.dockerignore
@@ -0,0 +1,3 @@
+/cache
+/log
+/src
diff --git a/dockerfiles/npm-browser-test-stretch/Dockerfile 
b/dockerfiles/npm-browser-test-stretch/Dockerfile
new file mode 100644
index 0000000..a02b3e8
--- /dev/null
+++ b/dockerfiles/npm-browser-test-stretch/Dockerfile
@@ -0,0 +1,31 @@
+FROM wmfreleng/npm-browser-test:latest as npm-browser-test
+
+FROM wmfreleng/npm-test-stretch:latest
+
+USER root
+RUN apt-get update && \
+    apt-get install --yes \
+        chromium \
+        firefox-esr \
+        phantomjs \
+        xvfb \
+    && \
+        apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Firefox always write to $HOME/.mozilla which is not available to the nobody
+# user. Provide a basic wrapper that points HOME to a temp directory.
+# See https://github.com/karma-runner/karma-firefox-launcher/issues/28
+RUN /bin/echo -e '#!/bin/sh\nHOME=/tmp/firefox\nexport HOME\nexec 
/usr/bin/firefox "$@"' > /usr/local/bin/firefox && \
+    chmod +x /usr/local/bin/firefox
+
+USER nobody
+ENV DISPLAY=:94
+# For karma-chrome-launcher
+ENV CHROME_BIN=/usr/bin/chromium
+
+# Can't change namespaces inside an unprivileged container, then we are already
+# in a namespace so just disable Chromium sandboxing
+ENV CHROMIUM_FLAGS="--no-sandbox"
+
+COPY --from=npm-browser-test /run-with-xvfb.sh /run-with-xvfb.sh
+ENTRYPOINT ["/run-with-xvfb.sh"]
diff --git a/dockerfiles/npm-browser-test-stretch/example-run.sh 
b/dockerfiles/npm-browser-test-stretch/example-run.sh
new file mode 100644
index 0000000..69c96e4
--- /dev/null
+++ b/dockerfiles/npm-browser-test-stretch/example-run.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -euo pipefail
+
+mkdir -m 777 -p log
+mkdir -m 777 -p src
+mkdir -m 777 -p cache
+#cd src
+#git init
+#git fetch --quiet --depth 1 
https://gerrit.wikimedia.org/r/data-values/value-view
+#git checkout FETCH_HEAD
+#cd ..
+
+docker run \
+    --rm --tty \
+    --volume /"$(pwd)"/log://var/lib/jenkins/log \
+    --volume /"$(pwd)"/cache://cache \
+    --volume /"$(pwd)"/src://src \
+     wmfreleng/npm-browser-test-stretch:latest
+rm -rf log

-- 
To view, visit https://gerrit.wikimedia.org/r/394340
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f24bb3a2bd6602424241d62c0b0f1de68e286cf
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to