feat: Add webbased VNC viewer (#306)

This commit is contained in:
Kroese 2024-01-07 22:37:58 +01:00 committed by GitHub
parent f54ef967c7
commit 003181333c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 12 deletions

View file

@ -2,18 +2,21 @@ FROM debian:trixie-slim
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN true
RUN apt-get update \
&& apt-get --no-install-recommends -y install \
tini \
wget \
ovmf \
novnc \
procps \
iptables \
iproute2 \
dnsmasq \
net-tools \
qemu-utils \
websockify \
ca-certificates \
netcat-openbsd \
qemu-system-x86 \
@ -24,7 +27,7 @@ COPY ./src /run/
RUN chmod +x /run/*.sh
VOLUME /storage
EXPOSE 22 5900
EXPOSE 22 5900 8006
ENV CPU_CORES "1"
ENV RAM_SIZE "1G"

View file

@ -16,6 +16,11 @@ cd /run
. config.sh # Configure arguments
trap - ERR
if [[ "${DISPLAY,,}" == "vnc" ]]; then
websockify -D --web /usr/share/novnc/ 8006 localhost:5900
fi
info "Booting image using $VERS..."
[[ "$DEBUG" == [Yy1]* ]] && set -x

View file

@ -1,16 +1,6 @@
#!/usr/bin/env bash
set -Eeuo pipefail
BASE="boot.img"
[ -f "$STORAGE/$BASE" ] && return 0
if [ -z "$BOOT" ]; then
error "No boot disk specified, set BOOT= to the URL of an ISO file." && exit 64
fi
BASE=$(basename "$BOOT")
[ -f "$STORAGE/$BASE" ] && return 0
# Check if running with interactive TTY or redirected to docker log
if [ -t 1 ]; then
PROGRESS="--progress=bar:noscroll"
@ -34,6 +24,16 @@ if [[ "${BOOT_MODE,,}" == "windows" ]]; then
fi
fi
BASE="boot.img"
[ -f "$STORAGE/$BASE" ] && return 0
if [ -z "$BOOT" ]; then
error "No boot disk specified, set BOOT= to the URL of an ISO file." && exit 64
fi
BASE=$(basename "$BOOT")
[ -f "$STORAGE/$BASE" ] && return 0
TMP="$STORAGE/${BASE%.*}.tmp"
rm -f "$TMP"

View file

@ -95,9 +95,10 @@ getPorts() {
local list=$1
local vnc="5900"
local novnc="8006"
if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
[ -z "$list" ] && list="$vnc" || list="$list,$vnc"
[ -z "$list" ] && list="$vnc,$novnc" || list="$list,$vnc,$novnc"
fi
[ -z "$list" ] && return 0