Added support for enabling kiosk mode and opening an URL at launch.

This commit is contained in:
Jocelyn Le Sage 2022-10-07 22:36:46 -04:00
parent b18027ec44
commit a50bede41a
5 changed files with 43 additions and 2 deletions

View File

@ -119,6 +119,11 @@ RUN \
set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \ set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \
true true
# Set public environment variables.
ENV \
FF_OPEN_URL= \
FF_KIOSK=0
# Define mountable directories. # Define mountable directories.
VOLUME ["/config"] VOLUME ["/config"]

View File

@ -112,6 +112,8 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
|`VNC_LISTENING_PORT`| Port used by the VNC server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over VNC. | `5900` | |`VNC_LISTENING_PORT`| Port used by the VNC server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over VNC. | `5900` |
|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | `""` | |`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | `""` |
|`ENABLE_CJK_FONT`| When set to `1`, open-source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` | |`ENABLE_CJK_FONT`| When set to `1`, open-source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` |
|`FF_OPEN_URL`| The URL to open when Firefox starts. | (unset) |
|`FF_KIOSK`| Set to `1` to enable kiosk mode. This mode launches Firefox in a very restricted and limited mode best suitable for public areas or customer-facing displays. | `0` |
### Data Volumes ### Data Volumes

View File

@ -261,7 +261,19 @@ container:
unsupported_volume: /storage unsupported_volume: /storage
# Environment variables. # Environment variables.
environment_variables: [] environment_variables:
- name: FF_OPEN_URL
description: >-
The URL to open when {{ app.friendly_name }} starts.
type: public
default:
- name: FF_KIOSK
description: >-
Set to `1` to enable kiosk mode. This mode launches Firefox in a very
restricted and limited mode best suitable for public areas or
customer-facing displays.
type: public
default: 0
# Volumes # Volumes
volumes: [] volumes: []

View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
# Set location of profile.
echo "--profile"
echo "/config/profile"
# Make sure we don't get ask to be the default browser.
echo "--setDefaultBrowser"
# Check if kiosk mode is enabled.
if [ "${FF_KIOSK:-0}" == 1 ]; then
echo "--kiosk"
fi
# URL to open.
# NOTE: This should be the last argument.
if [ -n "${FF_OPEN_URL:-}" ]; then
echo "$FF_OPEN_URL"
fi

View File

@ -6,4 +6,4 @@ set -u # Treat unset variables as an error.
export HOME=/config export HOME=/config
/usr/bin/firefox --version /usr/bin/firefox --version
exec /usr/bin/firefox --profile /config/profile --setDefaultBrowser >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log