diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f019c8c..d30dff5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,4 +121,4 @@ update_readmes: - $README_PASSWORD parallel: matrix: - - KASM_IMAGE: [chrome, chromium, firefox, desktop, desktop-deluxe, firefox-mobile, tor-browser, doom, edge, terminal, vmware-horizon, remmina, rdesktop, brave, discord, sublime-text, gimp, vs-code, slack, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, ubuntu-bionic-desktop, maltego, centos-7-desktop, telegram, hunchly, ubuntu-bionic-dind, ubuntu-bionic-dind-rootless, tracelabs, java-dev ] + - KASM_IMAGE: [chrome, chromium, firefox, desktop, desktop-deluxe, firefox-mobile, tor-browser, doom, edge, terminal, vmware-horizon, remmina, rdesktop, brave, discord, sublime-text, gimp, vs-code, slack, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, ubuntu-bionic-desktop, maltego, centos-7-desktop, telegram, hunchly, ubuntu-bionic-dind, ubuntu-bionic-dind-rootless, tracelabs, java-dev ] \ No newline at end of file diff --git a/dockerfile-kasm-realvnc-vncviewer b/dockerfile-kasm-realvnc-vncviewer new file mode 100644 index 0000000..94ae657 --- /dev/null +++ b/dockerfile-kasm-realvnc-vncviewer @@ -0,0 +1,34 @@ +ARG BASE_TAG="develop" +FROM kasmweb/core-ubuntu-bionic:$BASE_TAG +USER root + +ENV HOME /home/kasm-default-profile +ENV STARTUPDIR /dockerstartup +ENV INST_SCRIPTS $STARTUPDIR/install +WORKDIR $HOME + +######### Customize Container Here ########### + + +COPY ./src/ubuntu/install/realvnc_vncviewer $INST_SCRIPTS/realvnc_vncviewer/ +RUN bash $INST_SCRIPTS/realvnc_vncviewer/install_realvnc_vncviewer.sh && rm -rf $INST_SCRIPTS/realvnc_vncviewer/ + +COPY ./src/ubuntu/install/realvnc_vncviewer/custom_startup.sh $STARTUPDIR/custom_startup.sh +RUN chmod +x $STARTUPDIR/custom_startup.sh +RUN chmod 755 $STARTUPDIR/custom_startup.sh + + +# Update the desktop environment to be optimized for a single application +RUN cp $HOME/.config/xfce4/xfconf/single-application-xfce-perchannel-xml/* $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/ +RUN cp /usr/share/extra/backgrounds/bg_kasm.png /usr/share/extra/backgrounds/bg_default.png +RUN apt-get remove -y xfce4-panel + +######### End Customizations ########### + +RUN chown 1000:0 $HOME + +ENV HOME /home/kasm-user +WORKDIR $HOME +RUN mkdir -p $HOME && chown -R 1000:0 $HOME + +USER 1000 diff --git a/docs/realvnc-vncviewer/README.md b/docs/realvnc-vncviewer/README.md new file mode 100644 index 0000000..fc1e325 --- /dev/null +++ b/docs/realvnc-vncviewer/README.md @@ -0,0 +1,11 @@ +# About This Image + +This Image contains a browser-accessible version of [RealVNC vncviewer](https://www.realvnc.com/). + +![Screenshot][Image_Screenshot] + +[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/realvnc-vncviewer.png "Image Screenshot" + +# Environment Variables + +* `APP_ARGS` - Additional arguments to pass to the application when launched. diff --git a/docs/realvnc-vncviewer/description.txt b/docs/realvnc-vncviewer/description.txt new file mode 100644 index 0000000..662f847 --- /dev/null +++ b/docs/realvnc-vncviewer/description.txt @@ -0,0 +1 @@ +RealVNC vncviewer for Kasm Workspaces \ No newline at end of file diff --git a/src/ubuntu/install/realvnc_vncviewer/custom_startup.sh b/src/ubuntu/install/realvnc_vncviewer/custom_startup.sh new file mode 100644 index 0000000..c88bba1 --- /dev/null +++ b/src/ubuntu/install/realvnc_vncviewer/custom_startup.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +set -ex +START_COMMAND="/usr/bin/vncviewer" +PGREP="vncviewer" +MAXIMUS="false" +DEFAULT_ARGS="" +ARGS=${APP_ARGS:-$DEFAULT_ARGS} + +options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit +eval set -- "$options" + +while [[ $1 != -- ]]; do + case $1 in + -g|--go) GO='true'; shift 1;; + -a|--assign) ASSIGN='true'; shift 1;; + -u|--url) OPT_URL=$2; shift 2;; + *) echo "bad option: $1" >&2; exit 1;; + esac +done +shift + +# Process non-option arguments. +for arg; do + echo "arg! $arg" +done + +FORCE=$2 + +kasm_exec() { + if [ -n "$OPT_URL" ] ; then + URL=$OPT_URL + elif [ -n "$1" ] ; then + URL=$1 + fi + + # Since we are execing into a container that already has the browser running from startup, + # when we don't have a URL to open we want to do nothing. Otherwise a second browser instance would open. + if [ -n "$URL" ] ; then + /usr/bin/filter_ready + /usr/bin/desktop_ready + $START_COMMAND $ARGS $OPT_URL + else + echo "No URL specified for exec command. Doing nothing." + fi +} + +kasm_startup() { + if [ -n "$KASM_URL" ] ; then + URL=$KASM_URL + elif [ -z "$URL" ] ; then + URL=$LAUNCH_URL + fi + + if [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ; then + + if [[ $MAXIMUS == 'true' ]] ; then + maximus & + fi + + while true + do + if ! pgrep -x $PGREP > /dev/null + then + /usr/bin/filter_ready + /usr/bin/desktop_ready + set +e + $START_COMMAND $ARGS $URL + set -e + fi + sleep 1 + done + + fi + +} + +if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then + kasm_exec +else + kasm_startup +fi diff --git a/src/ubuntu/install/realvnc_vncviewer/install_realvnc_vncviewer.sh b/src/ubuntu/install/realvnc_vncviewer/install_realvnc_vncviewer.sh new file mode 100644 index 0000000..dd77fa0 --- /dev/null +++ b/src/ubuntu/install/realvnc_vncviewer/install_realvnc_vncviewer.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -ex +VNC_URL=$(curl -q https://www.realvnc.com/en/connect/download/viewer/linux/ | grep "DEB x64" | cut -d '"' -f6 | head -1) + +wget -q $VNC_URL -O vnc.deb +apt-get update +apt-get install -y ./vnc.deb +rm vnc.deb + +cp /usr/share/applications/realvnc-vncviewer.desktop $HOME/Desktop/ +chmod +x $HOME/Desktop/realvnc-vncviewer.desktop +chown 1000:1000 /usr/share/applications/realvnc-vncviewer.desktop +