From e437c3fecf8c22d592b6b29fd14a9db15bf1f2ce Mon Sep 17 00:00:00 2001 From: Remco Ros Date: Fri, 4 Oct 2024 12:14:48 +0000 Subject: [PATCH] add 'reconnect' setting and patch noVNC to fix issue after browser tab has been idle. --- Dockerfile | 38 +++++++++++++++++++++- Dockerfile.aarch64 | 43 ++++++++++++++++++++++++- Makefile | 5 +-- docker_entrypoint.sh | 7 +++++ manifest.yaml | 5 +-- patches/novnc.patch | 54 ++++++++++++++++++++++++++++++++ scripts/procedures/getConfig.ts | 6 ++++ scripts/procedures/migrations.ts | 21 ++++++++++++- 8 files changed, 172 insertions(+), 7 deletions(-) create mode 100644 patches/novnc.patch diff --git a/Dockerfile b/Dockerfile index 59d806a..9df0050 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,39 @@ -FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm-12c6f55b-ls87 AS buildstage +# taken from https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/debianbookworm/Dockerfile +# modified to apply 'novnc.patch' (fixing a disconnect/reconnect issue) +FROM node:12-buster AS wwwstage + +ARG KASMWEB_RELEASE="5ba4695e6526a27b8e38ec8d55dc33b39143e68a" + +RUN \ + echo "**** build clientside ****" && \ + mkdir /src && \ + cd /src && \ + wget https://github.com/kasmtech/noVNC/tarball/${KASMWEB_RELEASE} -O - \ + | tar --strip-components=1 -xz + +COPY ./patches/novnc.patch /src/ +RUN \ + export QT_QPA_PLATFORM=offscreen && \ + export QT_QPA_FONTDIR=/usr/share/fonts && \ + echo "apply novnc.patch" && \ + cd /src && \ + patch -p1 -i novnc.patch && \ + npm install && \ + npm run-script build + +RUN \ + echo "**** organize output ****" && \ + mkdir /build-out && \ + cd /src && \ + rm -rf node_modules/ && \ + cp -R ./* /build-out/ && \ + cd /build-out && \ + rm *.md && \ + rm AUTHORS && \ + cp index.html vnc.html && \ + mkdir Downloads + +FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm-f7a8978f-ls89 AS buildstage # these are specified in Makefile ARG ARCH @@ -107,6 +142,7 @@ RUN \ FROM scratch COPY --from=buildstage / . +COPY --from=wwwstage /build-out /usr/local/share/kasmvnc/www # since we start from scratch, we need these env variables from the base images ENV \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 745bd9b..d8b8799 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,44 @@ -FROM ghcr.io/linuxserver/baseimage-kasmvnc:arm64v8-debianbookworm-12c6f55b-ls87 AS buildstage +# taken from https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/debianbookworm/Dockerfile.aarch64 +# modified to apply 'novnc.patch' (fixing a disconnect/reconnect issue) +FROM node:12-buster AS wwwstage + +ARG KASMWEB_RELEASE="5ba4695e6526a27b8e38ec8d55dc33b39143e68a" + +RUN \ + echo "**** install build deps ****" && \ + apt-get update && \ + apt-get install -y phantomjs + +RUN \ + echo "**** build clientside ****" && \ + mkdir /src && \ + cd /src && \ + wget https://github.com/kasmtech/noVNC/tarball/${KASMWEB_RELEASE} -O - \ + | tar --strip-components=1 -xz + +COPY ./patches/novnc.patch /src/ +RUN \ + export QT_QPA_PLATFORM=offscreen && \ + export QT_QPA_FONTDIR=/usr/share/fonts && \ + echo "apply novnc.patch" && \ + cd /src && \ + patch -p1 -i novnc.patch && \ + npm install && \ + npm run-script build + +RUN \ + echo "**** organize output ****" && \ + mkdir /build-out && \ + cd /src && \ + rm -rf node_modules/ && \ + cp -R ./* /build-out/ && \ + cd /build-out && \ + rm *.md && \ + rm AUTHORS && \ + cp index.html vnc.html && \ + mkdir Downloads + +FROM ghcr.io/linuxserver/baseimage-kasmvnc:arm64v8-debianbookworm-f7a8978f-ls89 AS buildstage # these are specified in Makefile ARG ARCH @@ -107,6 +147,7 @@ RUN \ FROM scratch COPY --from=buildstage / . +COPY --from=wwwstage /build-out /usr/local/share/kasmvnc/www # since we start from scratch, we need these env variables from the base images ENV \ diff --git a/Makefile b/Makefile index cafaca1..607ff55 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ PKG_VERSION := $(shell yq e ".version" manifest.yaml) TS_FILES := $(shell find ./ -name \*.ts) ROOT_FILES := $(shell find ./root) ASSET_FILES := $(shell find ./assets/compat) +PATCH_FILES := $(shell find ./patches) .DELETE_ON_ERROR: @@ -43,7 +44,7 @@ clean: scripts/embassy.js: $(TS_FILES) deno bundle scripts/embassy.ts scripts/embassy.js -docker-images/aarch64.tar: manifest.yaml Dockerfile.aarch64 docker_entrypoint.sh $(ROOT_FILES) +docker-images/aarch64.tar: manifest.yaml Dockerfile.aarch64 docker_entrypoint.sh $(ROOT_FILES) $(PATCH_FILES) ifeq ($(ARCH),x86_64) else mkdir -p docker-images @@ -58,7 +59,7 @@ else --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar -f Dockerfile.aarch64 . endif -docker-images/x86_64.tar: manifest.yaml Dockerfile docker_entrypoint.sh $(ROOT_FILES) +docker-images/x86_64.tar: manifest.yaml Dockerfile docker_entrypoint.sh $(ROOT_FILES) $(PATCH_FILES) ifeq ($(ARCH),aarch64) else mkdir -p docker-images diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 472b72b..abd39e5 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -89,6 +89,13 @@ if [ $(yq e '.sparrow.managesettings' /root/data/start9/config.yaml) = "true" ]; esac fi +# remove reference to non-existing file, see: https://github.com/linuxserver/kclient/issues/8 +sed -i '/