Skip to content
Snippets Groups Projects
Verified Commit ab21b2ea authored by Armin Co's avatar Armin Co
Browse files

Initial commit

parent 367628a4
Branches
No related tags found
No related merge requests found
# novnc builder
FROM ubuntu:latest AS novnc
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
novnc \
net-tools \
bash \
pwgen \
x11vnc \
tigervnc-standalone-server \
tigervnc-viewer \
xtightvncviewer \
evince
COPY ./novnc_start.sh /
COPY ./vnc-testbild.pdf /
RUN chmod +x /novnc_start.sh && \
touch /root/.Xauthority
File added
version: '3.4'
services:
# just for building the image
#
novnc_image:
build:
context: ./
target: novnc
image: novnc
# example novnc "room"
novnc_1:
container_name: novnc_1 # is also the hostname
image: novnc
ports:
- 6081:6080 # webinterface port
- 5500:5500 # vnc listening viewer
restart: always
command: ["./novnc_start.sh, "testcvh_password"]
\ No newline at end of file
#!/bin/bash
## Config
#
# Arguments that can be passed to the script:
VIEW_PASSWORD=$1 # novnc
# Display where content should be shwon
# and that will be shared.
display=:0
## Functions
#
# start vnc viewer in listening mode
start_vnc_viewer() {
listening_port=5500
vnc_passwd="-passwd $HOME/.vnc/passwdp"
view_opts="-DotWhenNoCursor=on -ViewOnly -Shared -FullScreen -DesktopSize 1920x1080"
DISPLAY=$display xtigervncviewer $vnc_passwd $view_opts -listen $listening_port
}
# runs vnc_viewer
# and restarts after a lost connection
run_listening_vnc_viewer() {
while :
do
echo "Starting vnc listener"
start_vnc_viewer;
echo "Listener exited!'\n'";
sleep 1;
done
}
## Script
#
# setup vnc for the user
su $USER -c "mkdir $HOME/.vnc && \
echo '$VIEW_PASSWORD' | vncpasswd -f > $HOME/.vnc/passwd && \
echo '$PRESENTATION_PASSWORD' | vncpasswd -f > $HOME/.vnc/passwdp && \
chmod 600 $HOME/.vnc/passwd && \
chmod 600 $HOME/.vnc/passwdp && \
touch $HOME/.Xresources"
chown -R $USER:$USER $HOME
# start vnc server / create display
vnc_opts="-AcceptPointerEvents=off -AcceptKeyEvents=off -depth 24 -geometry 1920x1080"
tigervncserver $display $vnc_opts
# show a test image
DISPLAY=$display evince cvholp.pdf -p 1 --presentation &
# start a listening vnc_viewer
# which you can connect to
run_listening_vnc_viewer &
# start NoVNC
exec /usr/share/novnc/utils/launch.sh --listen 6080 --vnc localhost:5900
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment