first commit

This commit is contained in:
Jeffrey Paul 2024-05-17 15:59:57 -07:00
commit 8ab6af0825
6 changed files with 176 additions and 0 deletions

55
Dockerfile Normal file
View File

@ -0,0 +1,55 @@
# Use an official Ubuntu base image
FROM ubuntu:22.04
# Avoid warnings by switching to noninteractive for the build process
ENV DEBIAN_FRONTEND=noninteractive
ENV USER=root
# update system first
RUN apt update && apt upgrade -y
# Install XFCE, VNC server, dbus-x11, and xfonts-base
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
dbus-x11 \
tightvncserver \
vim \
xfce4 \
xfce4-goodies \
xfonts-base \
xinit \
wget \
curl \
xterm
WORKDIR /tmp
COPY ./install.sh ./install.sh
RUN bash ./install.sh
# Setup VNC server
RUN mkdir /root/.vnc \
&& echo "password" | vncpasswd -f > /root/.vnc/passwd \
&& chmod 600 /root/.vnc/passwd
COPY ./xstartup /root/.vnc/xstartup
# Create an .Xauthority file
RUN touch /root/.Xauthority
RUN chmod ugoa+rx /root/.vnc/xstartup
# Set display resolution (change as needed)
ENV RESOLUTION=1920x1080
# Expose VNC port
EXPOSE 5901
# Set the working directory in the container
WORKDIR /app
# Copy a script to start the VNC server
COPY init.sh init.sh
RUN chmod +x init.sh
CMD ["/app/init.sh"]

18
Makefile Normal file
View File

@ -0,0 +1,18 @@
export DOCKER_HOST := ssh://root@las1
build:
docker build \
-t sneak/vnc-desktop \
--progress plain \
.
run:
docker rm -f vnc-desktop
docker run \
-d -p 5901:5901 \
--name vnc-desktop \
--security-opt seccomp=unconfined \
sneak/vnc-desktop
logs:
docker logs -f vnc-desktop

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# vnc-desktop
containerized xfce4 ubuntu jaunty vnc desktop
# TODO
make it work as nonroot
get resizing support working
fix blurry fonts

24
init.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
echo 'Updating /etc/hosts file...'
HOSTNAME=$(hostname)
echo "127.0.1.1\t$HOSTNAME" >> /etc/hosts
echo "Starting VNC server"
vncserver -kill :1 || true
vncserver -geometry 1600x1200
#vncserver -geometry 1600x1200 -randr 1920x1080,1600x1200,1440x900,1024x768 &
echo "VNC server started at $RESOLUTION! ^-^"
export DISPLAY=":1"
xset -dpms &
xset s noblank &
xset s off &
/usr/bin/startxfce4 --replace > $HOME/wm.log &
xterm &
sleep 1
tail -f $HOME/wm.log $HOME/.vnc/*.log

61
install.sh Normal file
View File

@ -0,0 +1,61 @@
#!/bin/bash
set -x
PKGS="
alacritty
binutils
build-essential
byobu
ca-certificates
ctags
cups-common
curl
desktop-base
elementary-xfce-icon-theme
htop
jq
less
libnotify-bin
lsb-release
make
netbase
pastebinit
publicsuffix
run-one
screen
sudo
ttf-ubuntu-font-family
update-notifier-common
vim-doc
vim-scripts
wget
wordlist
xarchiver
xdg-user-dirs
xfdesktop4
xfdesktop4-data
zsh
zsh-doc
zstd
"
export DEBIAN_FRONTEND=noninteractive
apt install -y PKGS
install -d -m 0755 /etc/apt/keyrings
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | tee /etc/apt/preferences.d/mozilla
apt update
apt install -y firefox
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

7
xstartup Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
xsetroot -solid grey
autocutsel -fork
#geometry 640x480
startxfce4 &