Move all NoVNC instances to alpine image

This commit is contained in:
Myve 2025-01-21 01:25:25 +00:00
commit 7f0d398fbb
274 changed files with 349 additions and 50367 deletions

8
i3/.env Normal file
View file

@ -0,0 +1,8 @@
# .env for myvnc i3 webtop
MYVNC_I3_PORT=
MYVNC_I3_VNCPASS=
MYVNC_I3_CUSTOM_TITLE=
MYVNC_I3_PROXYPATH=
MYVNC_I3_VNCSHARING=

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Launch Tigervnc
/usr/bin/dbus-launch vncserver :0 &

View file

@ -1,22 +1,44 @@
# syntax = docker/dockerfile:1
FROM myvnc/arch/base
FROM quay.io/archlinux/archlinux:base-devel
USER root
# Build ARG for additional packages to install (eg, openssh)
ARG addpkg
# Build ARG: use "root" for debugging
ARG debug
# X session environment variable
ENV STARTXBIN=i3
# Copy mirrorlist
COPY mirrorlist /etc/pacman.d/mirrorlist
# Copy app folder
COPY entrypoint /entrypoint
# Install packages
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
pacman -Syu --ask 4 --needed \
tigervnc \
i3-wm ttf-dejavu \
&& pacman -Scc --ask 4
pacman-key --init \
&& sed -i '/ParallelDownloads/c ParallelDownloads = 10' /etc/pacman.conf \
&& pacman -Sy --ask 4 archlinux-keyring \
&& pacman -Su --ask 4 --needed ${addpkg} \
sudo bash bash-completion \
tigervnc \
i3-wm ttf-dejavu \
&& pacman -Scc --ask 4 \
&& useradd --create-home --gid users --shell /usr/bin/bash user \
&& printf '%s\n' 'user ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman' \
'Defaults lecture = never' >/etc/sudoers.d/zz-DOCKER \
&& passwd -l root >/dev/null 2>&1
# i3
COPY *.sh /app/init.d/
# Reset user home directory
# Default environment
USER ${debug:-user}
WORKDIR /home/user
ENV HOME=/home/user
ENV DISPLAY=:0
ENV SHELL=/usr/bin/bash
ENV PS1="[\u@\h \W \$?]\$ "
# X session environment variable
ENV STARTXBIN=i3
# Docker entrypoint
ENTRYPOINT ["/entrypoint"]

View file

@ -1,7 +1,15 @@
#!/usr/bin/env bash
# Docker build
# Optional: buildtag
# Optional buildtag, addpkg
# addpkg=openssh \
set -e
## Fetch latest mirrorlist
curl --fail --silent https://git.myvelabs.com/lab/archlinux/raw/branch/master/mirrorlist -o mirrorlist
DOCKER_BUILDKIT=1 \
docker build . \
--build-arg addpkg=${addpkg:-""} \
--build-arg debug=${debug:-""} \
--tag ${buildtag:-myvnc/arch/base:i3}
--tag ${buildtag:-myvnc/arch/i3}
rm mirrorlist

32
i3/docker-compose.yaml Normal file
View file

@ -0,0 +1,32 @@
services:
i3:
image: myvnc/arch/i3
container_name: i3
restart: unless-stopped
# build: .
# shm_size: 2gb
# security_opt:
# - seccomp:unconfined
environment:
MYVNC_VNCPASS: ${MYVNC_I3_VNCPASS}
networks:
- i3
i3-novnc:
image: myvnc/alpine/base
container_name: i3-novnc
restart: unless-stopped
ports:
- ${MYVNC_I3_PORT}:6900
environment:
MYVNC_CUSTOM_TITLE: ${MYVNC_I3_CUSTOM_TITLE}
MYVNC_PROXYPATH: ${MYVNC_I3_PROXYPATH}
MYVNC_VNCSHARING: ${MYVNC_I3_VNCSHARING}
MYVNC_VNCLISTEN_HOST: i3
MYVNC_VNCLISTEN_PORT: 5900
networks:
- i3
networks:
i3:
external: false

View file

@ -1,4 +1,22 @@
#!/usr/bin/env bash
# Export all variables
set -a
# Abort if an error is encountered
set -e
# SSH config
if [ -f ~/.ssh/id_ed25519 ]
then
chmod 0600 ~/.ssh/id_ed25519
fi
# Create base directories
for dir in ssh config/tigervnc
do
[ -d ~/.${dir} ] || mkdir -p ~/.${dir}/
done
# Check for MYVNC_VNCPASS variable
if [ -z ${MYVNC_VNCPASS} ]
then
@ -7,17 +25,17 @@ then
fi
# Configure tigervnc auth
if [ ! -f ~/.vnc/passwd ]
if [ ! -f ~/.config/tigervnc/passwd ]
then
echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.vnc/passwd
chmod 0600 ~/.vnc/passwd
echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.config/tigervnc/passwd
chmod 0600 ~/.config/tigervnc/passwd
fi
# Remove VNCPASS env
unset MYVNC_VNCPASS
# VNC xstartup
install /dev/stdin ~/.vnc/xstartup <<- xstartup
install /dev/stdin ~/.config/tigervnc/xstartup <<- xstartup
#!/usr/bin/env bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
@ -33,8 +51,9 @@ else
fi
# VNC config
cat >~/.vnc/config <<- vncconfig
cat >~/.config/tigervnc/config <<- vncconfig
session=i3
dpi=192
geometry=1920x1080
framerate=60
depth=32
@ -75,3 +94,6 @@ default_border none
# Execute startup script for webapp
exec --no-startup-id /usr/bin/bash ~/.config/i3/startapp.sh
i3config
# Launch Tigervnc
/usr/bin/dbus-launch vncserver :0

27
i3/up Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Docker build
# Optional buildtag
# DOCKER_BUILDKIT=1 \
# docker build . \
# --build-arg debug=${debug:-""} \
# --tag ${buildtag:-myvnc/novnc}
# Grab options
while [ ${1} ]
do
case ${1} in
-b | --build | b | build )
build="--build"
;;
-d | --detach | d | detach )
detach="--detach"
;;
bd | db )
build="--build"
detach="--detach"
;;
esac
shift
done
# Compose up
docker compose up ${build} ${detach}