diff --git a/plasma/10-tigervnc.sh b/plasma/10-tigervnc.sh new file mode 100755 index 0000000..9972de6 --- /dev/null +++ b/plasma/10-tigervnc.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Check for MYVNC_VNCPASS variable +if [ -z ${MYVNC_VNCPASS} ] +then + echo "MYVNC_VNCPASS env variable is missing" + exit 1 +fi + +# Configure tigervnc auth +if [ ! -f ~/.vnc/passwd ] +then + echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.vnc/passwd + chmod 0600 ~/.vnc/passwd +fi + +# Remove VNCPASS env +unset MYVNC_VNCPASS + +# VNC xstartup +install /dev/stdin ~/.vnc/xstartup <<- xstartup +#!/usr/bin/env bash +unset SESSION_MANAGER +unset DBUS_SESSION_BUS_ADDRESS +exec ${STARTXBIN} +xstartup + +# Turn vnc sharing on/off +if [[ ${MYVNC_VNCSHARING} == "true" ]] || [[ ${MYVNC_VNCSHARING} == "1" ]] +then + _MYVNC_VNCSHARING=alwaysshared +else + _MYVNC_VNCSHARING=nevershared +fi + +# VNC config +cat >~/.vnc/config <<- vncconfig +session=plasmax11 +geometry=1920x1080 +framerate=60 +depth=32 +${_MYVNC_VNCSHARING} +vncconfig + +# Disable KDE screenlock +cat >~/.config/kscreenlockerrc <<- 'kscreenlockerrc' +[Daemon] +Autolock=false +LockOnResume=false +Timeout=0 +kscreenlockerrc diff --git a/plasma/90-tigervnc.sh b/plasma/90-tigervnc.sh new file mode 100755 index 0000000..70cf0a9 --- /dev/null +++ b/plasma/90-tigervnc.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Launch Tigervnc +vncserver :0 & diff --git a/plasma/Dockerfile b/plasma/Dockerfile new file mode 100644 index 0000000..df9751c --- /dev/null +++ b/plasma/Dockerfile @@ -0,0 +1,25 @@ +# syntax = docker/dockerfile:1.2 +FROM alpine/base +USER root + +# X session environment variable +ENV STARTXBIN startplasma-x11 + +# Run +RUN apk add --no-cache \ + tigervnc \ + plasma-desktop-meta \ + font-dejavu \ + firefox \ + && printf '%s\n' 'permit nopass user as root cmd /sbin/apk add' >/etc/doas.conf + +# configure nvidia container runtime +# https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility + +# Tigervnc initialization scripts +COPY *.sh /app/init.d/ + +# Reset user home directory +USER user diff --git a/plasma/build b/plasma/build new file mode 100755 index 0000000..b6a00d1 --- /dev/null +++ b/plasma/build @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# Docker build +# Optional: buildtag +DOCKER_BUILDKIT=1 \ +docker build . \ + --tag ${buildtag:-alpine/webtop:plasma}