mirror of
https://git.myvelabs.com/novnc/alpine.git
synced 2025-12-17 21:36:21 +00:00
Add novnc/Dockerfile
This commit is contained in:
parent
4c43d46dd0
commit
2610d5cd18
1 changed files with 49 additions and 0 deletions
49
novnc/Dockerfile
Normal file
49
novnc/Dockerfile
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# syntax = docker/dockerfile:1
|
||||
FROM alpine/base
|
||||
USER root
|
||||
|
||||
# ENV variables
|
||||
# Required
|
||||
ENV MYVNC_VNCCLIENT_HOST=
|
||||
ENV MYVNC_VNCCLIENT_PORT=
|
||||
# Optional
|
||||
ENV MYVNC_VNCSERVER_PORT=
|
||||
|
||||
# Run
|
||||
RUN apk add --no-cache \
|
||||
openssh-client \
|
||||
&& <<- '01-init' cat >>/app/init.d/01-init.sh
|
||||
|
||||
# Check for client variables
|
||||
if ! [ ${MYVNC_VNCCLIENT_HOST} ]
|
||||
then
|
||||
echo "Variable MYVNC_VNCCLIENT_HOST is missing."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
if ! [ ${MYVNC_VNCCLIENT_PORT} ]
|
||||
then
|
||||
echo "Variable MYVNC_VNCCLIENT_PORT is missing."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
if ! [[ ${MYVNC_VNCCLIENT_PORT} =~ ^[0-9]+$ ]]
|
||||
then
|
||||
echo "Variable MYVNC_VNCCLIENT_PORT is invalid."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read ssh client variables hostname and port (5900, 5901, 5902, etc)
|
||||
if ssh ${MYVNC_VNCCLIENT_HOST} exit
|
||||
then
|
||||
ssh ${MYVNC_VNCCLIENT_HOST} -L ${MYVNC_VNCSERVER_PORT:-5900}:localhost:${MYVNC_VNCCLIENT_PORT} &
|
||||
else
|
||||
echo "Unable to establish SSH tunnel."
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
01-init
|
||||
|
||||
# Reset user home directory
|
||||
USER user
|
||||
Loading…
Add table
Add a link
Reference in a new issue