Skip to content

Commit 5a3948b

Browse files
authored
Merge pull request #7 from jens-maus/optimizations
Add more fine-tuned service autostart and command options behaviour
2 parents 15ab532 + 1962215 commit 5a3948b

12 files changed

Lines changed: 83 additions & 21 deletions

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This Docker image encapsulates a lightweight, VNC-accessible web browsing enviro
1414

1515
- **VNC-Ready**: Ready for use with any VNC client or through a web browser using noVNC, offering a user-friendly interface.
1616
- **Lightweight**: Built on Alpine Linux and Debian Slim, ensuring minimal resource usage.
17-
- **Customizable**: Set VNC password, initial website URL, auto-start settings for the browser and xterm via environment variables.
17+
- **Customizable**: Set VNC password, initial website URL, auto-start settings, etc. via environment variables to build custom environments (e.g. webkiosk)
1818
- **Accessible**: Access the VNC server directly or through a browser using noVNC.
1919

2020
## Available images 📦
@@ -54,6 +54,16 @@ You can customize the settings of the Docker container by passing environment va
5454
- Setting the resolution: `VNC_RESOLUTION="1280x720"`
5555
- Enabling/disabling auto-start for the browser: `AUTO_START_BROWSER=true` or `AUTO_START_BROWSER=false`
5656
- Enabling/disabling auto-start for xterm: `AUTO_START_XTERM=true` or `AUTO_START_XTERM=false`
57+
- Enabling/disabling auto-start for window manager (fluxbox): `AUTO_START_WM=true` or `AUTO_START_WM=false`
58+
- Enabling/disabling auto-start for x11vnc: `AUTO_START_X11VNC=true` or `AUTO_START_X11VNC=false`
59+
- Enabling/disabling auto-start for xvfb: `AUTO_START_XVFB=true` or `AUTO_START_XVFB=false`
60+
- Enabling/disabling auto-start for noVNC (websockify): `AUTO_START_NOVNC=true` or `AUTO_START_NOVNC=false`
61+
- Adding command options for browser: `BROWSER_OPTIONS="--start-fullscreen --kiosk --incognito --noerrdialogs --no-first-run --disk-cache-dir=/dev/null"`
62+
- Adding command options for x11vnc: `X11VNC_OPTIONS="-nocursor"`
63+
- Adding command options for xvfb: `XVFB_OPTIONS="-nocursor"`
64+
- Adding command options for window manager (fluxbox): `WM_OPTIONS="-rc /app/fluxbox.conf"`
65+
- Adding command options for noVNC (websockify): `NOVNC_OPTIONS="--heartbeat=10"`
66+
- Adding command options for xterm: `XTERM_OPTIONS="-leftbar"`
5767

5868
### Available Variables ⚙️
5969
- `VNC_SCREEN` (default: `0`): Screen number for VNC.
@@ -68,8 +78,18 @@ You can customize the settings of the Docker container by passing environment va
6878
- `CUSTOMIZE` (default: `false`): Toggle for running custom scripts.
6979
- `AUTO_START_BROWSER` (default: `true`): Automatically start the browser.
7080
- `AUTO_START_XTERM` (default: `true`): Automatically start xterm.
81+
- `AUTO_START_WM` (default: `true`): Automatically start window manager (fluxbox).
82+
- `AUTO_START_X11VNC` (default: `true`): Automatically start x11vnc.
83+
- `AUTO_START_XVFB` (default: `true`): Automatically start xvfb.
84+
- `AUTO_START_NOVNC` (default: `true`): Automatically start noVNC (websockify).
7185
- `CUSTOM_ENTRYPOINTS_DIR` (default: `/app/custom_entrypoints_scripts`): Directory for custom entry point scripts.
7286
- `DEBIAN_FRONTEND` (default: `noninteractive`): Frontend setting for Debian-based installations.
87+
- `BROWSER_OPTIONS` (default: ``): Additional command options to provide to browser start.
88+
- `X11VNC_OPTIONS` (default: ``): Additional command options to provide to x11vnc start.
89+
- `XVFB_OPTIONS` (default: ``): Additional command options to provide to xvfb start.
90+
- `WM_OPTIONS` (default: ``): Additional command options to provide to windows manager (fluxbox) start.
91+
- `NOVNC_OPTIONS` (default: ``): Additional command options to provide to noVNC (websockify) start.
92+
- `XTERM_OPTIONS` (default: ``): Additional command options to provide to xterm start.
7393

7494
- Example:
7595
```sh

alpine.dockerfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ ARG DEF_CUSTOMIZE=false
1515
ARG DEF_CUSTOM_ENTRYPOINTS_DIR=/app/custom_entrypoints_scripts
1616
ARG DEF_AUTO_START_BROWSER=true
1717
ARG DEF_AUTO_START_XTERM=true
18+
ARG DEF_AUTO_START_WM=true
19+
ARG DEF_AUTO_START_X11VNC=true
20+
ARG DEF_AUTO_START_XVFB=true
21+
ARG DEF_AUTO_START_NOVNC=true
22+
ARG DEF_BROWSER_OPTIONS=
23+
ARG DEF_X11VNC_OPTIONS=
24+
ARG DEF_XVFB_OPTIONS=
25+
ARG DEF_WM_OPTIONS=
26+
ARG DEF_NOVNC_OPTIONS=
27+
ARG DEF_XTERM_OPTIONS=
1828

1929
# Set environment variables with default values
2030
ENV DISPLAY=:${DEF_VNC_DISPLAY}.${DEF_VNC_SCREEN} \
@@ -30,7 +40,17 @@ ENV DISPLAY=:${DEF_VNC_DISPLAY}.${DEF_VNC_SCREEN} \
3040
CUSTOMIZE=${DEF_CUSTOMIZE} \
3141
CUSTOM_ENTRYPOINTS_DIR=${DEF_CUSTOM_ENTRYPOINTS_DIR} \
3242
AUTO_START_BROWSER=${DEF_AUTO_START_BROWSER} \
33-
AUTO_START_XTERM=${DEF_AUTO_START_XTERM}
43+
AUTO_START_XTERM=${DEF_AUTO_START_XTERM} \
44+
AUTO_START_WM=${DEF_AUTO_START_WM} \
45+
AUTO_START_X11VNC=${DEF_AUTO_START_X11VNC} \
46+
AUTO_START_XVFB=${DEF_AUTO_START_XVFB} \
47+
AUTO_START_NOVNC=${DEF_AUTO_START_NOVNC} \
48+
BROWSER_OPTIONS=${DEF_BROWSER_OPTIONS} \
49+
X11VNC_OPTIONS=${DEF_X11VNC_OPTIONS} \
50+
XVFB_OPTIONS=${DEF_XVFB_OPTIONS} \
51+
WM_OPTIONS=${DEF_WM_OPTIONS} \
52+
NOVNC_OPTIONS=${DEF_NOVNC_OPTIONS} \
53+
XTERM_OPTIONS=${DEF_XTERM_OPTIONS}
3454

3555
# Install necessary packages and setup noVNC
3656
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \

base_entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
# Store the password
5-
if [ "$VNC_PASSWORD" ]; then
6-
sed -i "s/^\(command.*x11vnc.*\)$/\1 -passwd '$VNC_PASSWORD'/" /app/conf.d/x11vnc.conf
4+
# Add password to x11vnc options
5+
if [ -n "${VNC_PASSWORD}" ]; then
6+
X11VNC_OPTIONS="${X11VNC_OPTIONS} -passwd '${VNC_PASSWORD}'"
77
fi
88

99
# Print current VNC info

browser_conf/chromium.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:chromium]
2-
command=/usr/bin/chromium --no-sandbox --disable-dev-shm-usage %(ENV_STARTING_WEBSITE_URL)s
2+
command=/usr/bin/chromium --no-sandbox --disable-dev-shm-usage %(ENV_BROWSER_OPTIONS)s %(ENV_STARTING_WEBSITE_URL)s
33
autostart=%(ENV_AUTO_START_BROWSER)s
44
autorestart=true
55
stdout_logfile=/var/log/chromium.log

browser_conf/firefox.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:firefox]
2-
command=/usr/bin/firefox %(ENV_STARTING_WEBSITE_URL)s
2+
command=/usr/bin/firefox %(ENV_BROWSER_OPTIONS)s %(ENV_STARTING_WEBSITE_URL)s
33
autostart=%(ENV_AUTO_START_BROWSER)s
44
autorestart=true
55
stdout_logfile=/var/log/firefox.log

conf.d/fluxbox.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:fluxbox]
2-
command=fluxbox
3-
autostart=true
2+
command=fluxbox %(ENV_WM_OPTIONS)s
3+
autostart=%(ENV_AUTO_START_WM)s
44
autorestart=true
55
# stdout_logfile=/var/log/fluxbox.log
6-
# stderr_logfile=/var/log/fluxbox.err.log
6+
# stderr_logfile=/var/log/fluxbox.err.log

conf.d/websockify.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:websockify]
2-
command=websockify --web=/usr/share/novnc/ %(ENV_NOVNC_WEBSOCKIFY_PORT)s localhost:%(ENV_VNC_PORT)s
3-
autostart=true
2+
command=websockify --web=/usr/share/novnc/ %(ENV_NOVNC_OPTIONS)s %(ENV_NOVNC_WEBSOCKIFY_PORT)s localhost:%(ENV_VNC_PORT)s
3+
autostart=%(ENV_AUTO_START_NOVNC)s
44
autorestart=true
55
# stdout_logfile=/var/log/websockify.log
6-
# stderr_logfile=/var/log/websockify.err.log
6+
# stderr_logfile=/var/log/websockify.err.log

conf.d/x11vnc.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:x11vnc]
2-
command=x11vnc -display :%(ENV_VNC_DISPLAY)s.%(ENV_VNC_SCREEN)s -forever -usepw -shared -rfbport %(ENV_VNC_PORT)s
3-
autostart=true
2+
command=x11vnc -display :%(ENV_VNC_DISPLAY)s.%(ENV_VNC_SCREEN)s -forever -usepw -shared -rfbport %(ENV_VNC_PORT)s %(ENV_X11VNC_OPTIONS)s
3+
autostart=%(ENV_AUTO_START_X11VNC)s
44
autorestart=true
55
# stdout_logfile=/var/log/x11vnc.log
6-
# stderr_logfile=/var/log/x11vnc.err.log
6+
# stderr_logfile=/var/log/x11vnc.err.log

conf.d/xterm.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:xterm]
2-
command=/usr/bin/xterm
2+
command=/usr/bin/xterm %(ENV_XTERM_OPTIONS)s
33
autostart=%(ENV_AUTO_START_XTERM)s
44
autorestart=true
55
stdout_logfile=/var/log/xterm.log

conf.d/xvfb.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[program:xvfb]
2-
command=Xvfb :%(ENV_VNC_DISPLAY)s -screen %(ENV_VNC_SCREEN)s %(ENV_VNC_RESOLUTION)sx24 -listen tcp -ac
3-
autostart=true
2+
command=Xvfb :%(ENV_VNC_DISPLAY)s -screen %(ENV_VNC_SCREEN)s %(ENV_VNC_RESOLUTION)sx24 -listen tcp -ac %(ENV_XVFB_OPTIONS)s
3+
autostart=%(ENV_AUTO_START_XVFB)s
44
autorestart=true
55
# stdout_logfile=/var/log/xvfb.log
6-
# stderr_logfile=/var/log/xvfb.err.log
6+
# stderr_logfile=/var/log/xvfb.err.log

0 commit comments

Comments
 (0)