forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
karatelabs#2422 add new image for chromium
- Loading branch information
Guillaume Barry
committed
Nov 1, 2023
1 parent
64042c6
commit e96a7ad
Showing
3 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM maven:3-amazoncorretto-17-debian | ||
|
||
LABEL maintainer="Peter Thomas" | ||
LABEL url="https://github.com/karatelabs/karate/tree/master/karate-docker/karate-chromium" | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
wget \ | ||
gnupg2 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
chromium | ||
|
||
RUN useradd chrome --shell /bin/bash --create-home \ | ||
&& usermod -a -G sudo chrome \ | ||
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \ | ||
&& echo 'chrome:karate' | chpasswd | ||
|
||
RUN apt-get install -y --no-install-recommends \ | ||
xvfb \ | ||
x11vnc \ | ||
xterm \ | ||
fluxbox \ | ||
wmctrl \ | ||
supervisor \ | ||
socat \ | ||
ffmpeg \ | ||
locales \ | ||
locales-all | ||
|
||
ENV LANG en_US.UTF-8 | ||
|
||
RUN apt-get clean \ | ||
&& rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/* /tmp/* \ | ||
&& mkdir ~/.vnc \ | ||
&& x11vnc -storepasswd karate ~/.vnc/passwd \ | ||
&& locale-gen ${LANG} \ | ||
&& dpkg-reconfigure --frontend noninteractive locales \ | ||
&& update-locale LANG=${LANG} | ||
|
||
COPY supervisord.conf /etc | ||
COPY entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
|
||
EXPOSE 5900 9222 | ||
|
||
ADD target/karate.jar / | ||
ADD target/repository /usr/share/maven/ref/repository | ||
|
||
CMD ["/bin/bash", "/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -x -e | ||
if [ -z "$KARATE_JOBURL" ] | ||
then | ||
export KARATE_OPTIONS="-h" | ||
export KARATE_START="false" | ||
else | ||
export KARATE_START="true" | ||
export KARATE_OPTIONS="-j $KARATE_JOBURL" | ||
fi | ||
if [ -z "$KARATE_SOCAT_START" ] | ||
then | ||
export KARATE_SOCAT_START="false" | ||
export KARATE_CHROME_PORT="9222" | ||
else | ||
export KARATE_SOCAT_START="true" | ||
export KARATE_CHROME_PORT="9223" | ||
fi | ||
[ -z "$KARATE_WIDTH" ] && export KARATE_WIDTH="1280" | ||
[ -z "$KARATE_HEIGHT" ] && export KARATE_HEIGHT="720" | ||
exec /usr/bin/supervisord -c /etc/supervisord.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
[supervisord] | ||
user=root | ||
nodaemon=true | ||
|
||
[unix_http_server] | ||
file=/tmp/supervisor.sock | ||
username=dummy | ||
password=dummy | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///tmp/supervisor.sock | ||
username=dummy | ||
password=dummy | ||
|
||
[program:xvfb] | ||
command=/usr/bin/Xvfb :1 -screen 0 %(ENV_KARATE_WIDTH)sx%(ENV_KARATE_HEIGHT)sx24 +extension RANDR | ||
autorestart=true | ||
priority=100 | ||
|
||
[program:fluxbox] | ||
environment=DISPLAY=":1" | ||
command=/usr/bin/fluxbox -display :1 | ||
autorestart=true | ||
priority=200 | ||
|
||
[program:x11vnc] | ||
command=/usr/bin/x11vnc -display :1 -usepw -shared -forever -xrandr | ||
autorestart=true | ||
priority=300 | ||
|
||
[program:chrome] | ||
user=chrome | ||
environment=HOME="/home/chrome",USER="chrome",DISPLAY=":1",DBUS_SESSION_BUS_ADDRESS="unix:path=/dev/null" | ||
command=/usr/bin/chromium | ||
--user-data-dir=/home/chrome | ||
--no-first-run | ||
--disable-translate | ||
--disable-notifications | ||
--disable-popup-blocking | ||
--disable-infobars | ||
--disable-gpu | ||
--mute-audio | ||
--dbus-stub | ||
--disable-dev-shm-usage | ||
--enable-logging=stderr | ||
--log-level=0 | ||
--window-position=0,0 | ||
--window-size=%(ENV_KARATE_WIDTH)s,%(ENV_KARATE_HEIGHT)s | ||
--force-device-scale-factor=1 | ||
--remote-allow-origins=* | ||
--remote-debugging-port=%(ENV_KARATE_CHROME_PORT)s | ||
autorestart=true | ||
priority=400 | ||
|
||
[program:socat] | ||
command=/usr/bin/socat tcp-listen:9222,fork tcp:localhost:9223 | ||
autorestart=true | ||
autostart=%(ENV_KARATE_SOCAT_START)s | ||
priority=500 | ||
|
||
[program:ffmpeg] | ||
command=/usr/bin/ffmpeg -y -f x11grab -r 16 -s %(ENV_KARATE_WIDTH)sx%(ENV_KARATE_HEIGHT)s -i :1 -vcodec libx264 -pix_fmt yuv420p -preset fast /tmp/karate.mp4 | ||
autostart=%(ENV_KARATE_SOCAT_START)s | ||
priority=600 | ||
|
||
[program:karate] | ||
command=/usr/bin/java -jar karate.jar %(ENV_KARATE_OPTIONS)s | ||
autorestart=false | ||
autostart=%(ENV_KARATE_START)s | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
priority=700 |