forked from uw-psych/hyakvnc_apptainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying out something to mirror klone's rocky
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
Bootstrap: docker | ||
From: rockylinux:{{ROCKYLINUX_VERSION}} | ||
|
||
%arguments | ||
ROCKYLINUX_VERSION=8.5 | ||
|
||
%help | ||
This is an Apptainer container of Rocky Linux 8.5 with TurboVNC and XFCE installed. | ||
|
||
%files | ||
../scripts/install-turbovnc.sh /opt/install-turbovnc.sh | ||
../configs/xfce4 /configs-xfce4 | ||
|
||
%environment | ||
export LANG=C.UTF-8 | ||
export LC_ALL=C.UTF-8 | ||
export TZ=America/Los_Angeles | ||
export VNC_DEFAULT_PASSWORD="password" | ||
export PATH="/opt/TurboVNC/bin:$PATH" | ||
export TVNC_WM=xfce | ||
export HYAKVNC_USER_BASE_DIR="/vnc" | ||
export HYAKVNC_USER_SOCKET="${HYAKVNC_USER_BASE_DIR}/socket.uds" | ||
export HYAKVNC_USER_LOGFILE="${HYAKVNC_USER_BASE_DIR}/vnc.log" | ||
export HYAKVNC_USER_PASSWORDFILE="${HYAKVNC_USER_BASE_DIR}/passwd" | ||
export HYAKVNC_USER_DISPLAY=":10" | ||
export SHELL="${SHELL:-/bin/bash}" | ||
|
||
%post | ||
set -e | ||
set -x | ||
export LANG=C.UTF-8 | ||
export LC_ALL=C.UTF-8 | ||
export TZ=America/Los_Angeles | ||
dnf update -y | ||
dnf install -y epel-release | ||
dnf --enablerepo=epel group | ||
/opt/install-turbovnc.sh && rm -f /opt/install-turbovnc.sh || exit 1 | ||
dnf groupinstall -y "Xfce" "base-x" | ||
dnf clean all | ||
# Move XFCE configs to correct directories: | ||
mkdir -p /etc/xdg/xfce4/xfconf/xfce-perchannel-xml /etc/xdg/xfce4/whiskermenu /etc/xdg/xfce4/terminal | ||
mv /configs-xfce4/xfconf/xfce-perchannel-xml/*.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/ | ||
mv /configs-xfce4/whiskermenu/defaults.rc /etc/xdg/xfce4/whiskermenu/ | ||
mv /configs-xfce4/terminal/terminalrc /etc/xdg/xfce4/terminal/ | ||
rm -rf /configs-xfce4 | ||
|
||
# Set up TurboVNC's base directory to be in the container's /vnc directory: | ||
echo '$vncUserDir = "$ENV{HYAKVNC_USER_BASE_DIR}";' >> /etc/turbovncserver.conf | ||
%apprun vncpasswd | ||
# Set VNC password: | ||
VNC_PASSWORD="${1:-${VNC_PASSWORD:-${VNC_DEFAULT_PASSWORD:-}}}" | ||
VNC_PASSWORD_FILE="${2:-${VNC_PASSWORD_FILE:-${HYAKVNC_USER_PASSWORDFILE:-}}}" | ||
mkdir -p "$(dirname "${VNC_PASSWORD_FILE}")" \ | ||
&& echo "${VNC_PASSWORD}" | vncpasswd -f > "${VNC_PASSWORD_FILE}" \ | ||
&& chmod 600 "${VNC_PASSWORD_FILE}" \ | ||
&& echo "Set VNC password to ${VNC_PASSWORD} in file ${VNC_PASSWORD_FILE}" | ||
|
||
%apprun vncserver | ||
# Set password if not exists: | ||
mkdir -p "$(dirname "${HYAKVNC_USER_BASE_DIR}")" | ||
[ -e "${HYAKVNC_USER_PASSWORDFILE}" ] || /scif/apps/vncpasswd/scif/runscript | ||
echo "$(uname -n)" > "${HYAKVNC_USER_BASE_DIR}/hostname" \ | ||
&& exec vncserver \ | ||
"${HYAKVNC_USER_DISPLAY}" \ | ||
-fg \ | ||
-uds \ | ||
-log "${HYAKVNC_USER_LOGFILE}" \ | ||
-rfbunixpath "${HYAKVNC_USER_SOCKET}" \ | ||
"${@}" | ||
|
||
%apprun vnckill | ||
[ -e "${HYAKVNC_USER_SOCKET}" ] && vncserver -kill "${HYAKVNC_USER_DISPLAY}" | ||
|
||
%runscript | ||
# Run app vncserver: | ||
exec /scif/apps/vncserver/scif/runscript | ||
|