Redo plasma to use novnc from alpine

This commit is contained in:
Myve 2025-01-20 09:45:38 +00:00
commit d3411e2fe9
6 changed files with 89 additions and 18 deletions

View file

@ -1,31 +1,57 @@
# syntax = docker/dockerfile:1 # syntax = docker/dockerfile:1
FROM myvnc/arch/base FROM quay.io/archlinux/archlinux:base-devel
USER root USER root
# X session environment variable # Build ARG for additional packages to install (eg, openssh)
ENV STARTXBIN=startplasma-x11 ARG addpkg
# Build ARG: use "root" for debugging
ARG debug
# Copy mirrorlist
COPY mirrorlist /etc/pacman.d/mirrorlist
# Copy app folder
COPY app /app
# Install packages # Install packages
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
pacman -Syu --ask 4 --needed \ pacman-key --init \
tigervnc \ && sed -i '/ParallelDownloads/c ParallelDownloads = 10' /etc/pacman.conf \
cuda openssh vim pacman-contrib rsync git \ && pacman -Sy --ask 4 archlinux-keyring \
plasma konsole kate dolphin kompare kcalc \ && pacman -Su --ask 4 --needed ${addpkg} \
jack2 ttf-dejavu \ sudo bash bash-completion \
firefox firefox-decentraleyes firefox-ublock-origin \ tigervnc \
torbrowser-launcher \ cuda openssh vim pacman-contrib rsync git \
shotwell ffmpegthumbs ark okular \ plasma konsole kate dolphin kompare kcalc \
remmina libvncserver \ jack2 ttf-dejavu \
firefox firefox-decentraleyes firefox-ublock-origin \
torbrowser-launcher \
shotwell ffmpegthumbs ark okular \
remmina libvncserver \
&& pacman -Scc --ask 4 \ && pacman -Scc --ask 4 \
&& printf '%s\n' 'Cmnd_Alias MISCELLANEOUS = /usr/bin/pacman' >/etc/sudoers.d/01-MISCELLANEOUS && 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 \
&& mkdir -p /app/nginx /app/logs \
&& chown -R user:users /app
# 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=startplasma-x11
# configure nvidia container runtime # configure nvidia container runtime
# https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec # https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec
ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
# Tigervnc # Docker entrypoint
COPY *.sh /app/init.d/ ENTRYPOINT ["/app/entrypoint"]
# Reset user home directory
USER user

24
plasma/app/entrypoint Executable file
View file

@ -0,0 +1,24 @@
#!/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
# Run all scripts in init folder
for file in /app/init.d/*.sh
do
/usr/bin/bash -c ${file} >>/app/logs/$(echo ${file} | sed 's|/app/init.d/||;s|\.sh$||').log
done
# Read cli parameters
exec "${@}" &
# Monitor log
tail -f /app/logs/*.log

6
plasma/app/init.d/01-init.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Create base directories
for dir in ssh config/tigervnc
do
[ -d ~/.${dir} ] || mkdir -p ~/.${dir}
done

15
plasma/build Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Docker build
# 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/plasma}
rm mirrorlist