From e111915109d4ea25458061e57032921508fd38c5 Mon Sep 17 00:00:00 2001 From: myve Date: Sun, 21 Jul 2024 21:30:46 +0000 Subject: [PATCH] Add xfce webtop --- xfce/10-tigervnc.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ xfce/90-tigervnc.sh | 3 +++ xfce/Dockerfile | 23 +++++++++++++++++++++++ xfce/build | 7 +++++++ 4 files changed, 75 insertions(+) create mode 100755 xfce/10-tigervnc.sh create mode 100755 xfce/90-tigervnc.sh create mode 100644 xfce/Dockerfile create mode 100755 xfce/build diff --git a/xfce/10-tigervnc.sh b/xfce/10-tigervnc.sh new file mode 100755 index 0000000..aaf3fb9 --- /dev/null +++ b/xfce/10-tigervnc.sh @@ -0,0 +1,42 @@ +#!/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=xfce +geometry=1920x1080 +framerate=60 +depth=32 +${_MYVNC_VNCSHARING} +vncconfig diff --git a/xfce/90-tigervnc.sh b/xfce/90-tigervnc.sh new file mode 100755 index 0000000..70cf0a9 --- /dev/null +++ b/xfce/90-tigervnc.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Launch Tigervnc +vncserver :0 & diff --git a/xfce/Dockerfile b/xfce/Dockerfile new file mode 100644 index 0000000..ccb73c6 --- /dev/null +++ b/xfce/Dockerfile @@ -0,0 +1,23 @@ +# syntax = docker/dockerfile:1 +FROM alpine/base +USER root + +# Build ARG: use "root" for debugging +ARG debug + +# X session environment variable +ENV STARTXBIN=startxfce4 + +# Run +RUN apk add --no-cache \ + tigervnc \ + xfce4 xfce4-terminal adwaita-icon-theme \ + font-dejavu \ + firefox \ + && printf '%s\n' 'permit nopass user as root cmd /sbin/apk args add' >>/etc/doas.conf + +# Tigervnc initialization scripts +COPY *.sh /app/init.d/ + +# Default environment +USER ${debug:-user} diff --git a/xfce/build b/xfce/build new file mode 100755 index 0000000..d675da6 --- /dev/null +++ b/xfce/build @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Docker build +# Optional: buildtag +DOCKER_BUILDKIT=1 \ +docker build . \ + --build-arg debug=${debug:-""} \ + --tag ${buildtag:-alpine/webtop:xfce}