mirror of
https://git.myvelabs.com/novnc/archlinux.git
synced 2025-12-17 21:26:20 +00:00
117 lines
No EOL
2.4 KiB
Bash
117 lines
No EOL
2.4 KiB
Bash
## Dockerfile
|
|
cat >Dockerfile <<- 'Dockerfile'
|
|
# syntax = docker/dockerfile:1.2
|
|
FROM myvnc/base
|
|
USER root
|
|
|
|
# X session environment variable
|
|
ENV STARTXBIN i3
|
|
|
|
# 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
|
|
|
|
# i3
|
|
COPY 10-tigervnc.sh 90-tigervnc.sh /app/init.d/
|
|
RUN chmod +x /app/init.d/*
|
|
|
|
# Reset user home directory
|
|
USER user
|
|
WORKDIR /home/user
|
|
Dockerfile
|
|
|
|
## i3/tigervnc Setup
|
|
cat >10-tigervnc.sh <<- '10-tigervnc.sh'
|
|
#!/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=i3
|
|
geometry=1920x1080
|
|
framerate=60
|
|
depth=32
|
|
${_MYVNC_VNCSHARING}
|
|
vncconfig
|
|
|
|
# i3 preferences
|
|
mkdir -p ~/.config/i3/config.d
|
|
cat >~/.config/i3/config <<- 'i3config'
|
|
# Font
|
|
font pango:DejaVu Sans Mono 8
|
|
|
|
# Include custom config
|
|
include ~/.config/i3/config.d/*.conf
|
|
|
|
# Binds for killing application
|
|
bindsym Mod1+Mod4+Shift+q kill
|
|
bindsym Mod1+Mod4+Shift+f fullscreen toggle
|
|
|
|
# Binds for cycling workspaces
|
|
bindsym Mod1+Mod4+Shift+Right workspace next
|
|
bindsym Mod1+Mod4+Shift+Left workspace prev
|
|
|
|
# Locked mode
|
|
mode locked {
|
|
bindsym Mod4+Mod1+Escape mode default
|
|
}
|
|
bindsym Mod4+Mod1+Escape mode locked
|
|
|
|
# Hide bar permanently
|
|
exec --no-startup-id i3-msg bar mode invisible
|
|
|
|
# Always open window in fullscreen
|
|
for_window [all] fullscreen enable
|
|
for_window [all] border none
|
|
default_border none
|
|
|
|
# Execute startup script for webapp
|
|
exec --no-startup-id /usr/bin/bash ~/.config/i3/startapp.sh
|
|
i3config
|
|
10-tigervnc.sh
|
|
|
|
## TigerVNC launch script
|
|
cat >90-tigervnc.sh <<- '90-tigervnc.sh'
|
|
#!/usr/bin/env bash
|
|
# Launch Tigervnc
|
|
/usr/bin/dbus-launch vncserver :0 &
|
|
90-tigervnc.sh
|
|
|
|
## Docker build
|
|
DOCKER_BUILDKIT=1 docker build ./. \
|
|
--tag myvnc/base:i3 \
|
|
&& rm -f Dockerfile *.sh |