Unverified Commit 00318133 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Add webbased VNC viewer (#306)

parent f54ef967
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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"
+5 −0
Original line number Diff line number Diff line
@@ -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
+10 −10
Original line number Diff line number Diff line
#!/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"

+2 −1
Original line number Diff line number Diff line
@@ -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