From 58c9a823647aecb16f6946f419032ce65b09a49a Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 11 Dec 2020 13:41:11 +0100 Subject: [PATCH] first commit --- Dockerfile | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 43 ++++++++++++++++++++++++++++++++++++++++++ makefile | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ supervisord.conf | 23 +++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 makefile create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..173a52a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +FROM alpine:latest +#https://github.com/uphy/novnc-alpine-docker +RUN \ + apk --update --upgrade add \ + bash \ + fluxbox \ + git \ + supervisor \ + xvfb \ + x11vnc \ + && \ + # Install noVNC + git clone --depth 1 https://github.com/novnc/noVNC.git /opt/noVNC && \ + git clone --depth 1 https://github.com/novnc/websockify /opt/noVNC/utils/websockify && \ + rm -rf /opt/noVNC/.git && \ + rm -rf /opt/noVNC/utils/websockify/.git && \ + apk del git && \ + sed -i -- "s/ps -p/ps -o pid | grep/g" /opt/noVNC/utils/launch.sh + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +EXPOSE 8080 + +# Setup environment variables +ENV HOME=/root \ + DEBIAN_FRONTEND=noninteractive \ + LANG=en_US.UTF-8 \ + LANGUAGE=en_US.UTF-8 \ + LC_ALL=C.UTF-8 \ + DISPLAY=:0.0 \ + DISPLAY_WIDTH=1280 \ + DISPLAY_HEIGHT=680 + +#AJOUT BMT pour lancher xterm +RUN \ + # Install xterm + apk add xterm && \ + apk add firefox-esr dbus ttf-freefont && \ + # Append xterm entry to supervisord.conf + cd /etc/supervisor/conf.d && \ + echo '[program:xterm]' >> supervisord.conf && \ + echo 'command=xterm' >> supervisord.conf && \ + echo 'autorestart=true' >> supervisord.conf + +#AJOUT BEN pour alias index>vnc.html +RUN \ + cd /opt/noVNC && \ + ln -s vnc.html index.html + +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fb0936 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Dockerfile for noVNC + +This repository provides the base image of noVNC. + +# Run (Simple) + +You can run this image as follows. + +```bash +$ docker run -it --rm -p 8080:8080 uphy/novnc-alpine +``` + +Please extend this image and install the GUI apps you want, +because there's no applications installed in this image. + +# Run (With your apps) + +For example, you can run 'xterm' on the docker container and provide the app in the browser as follows. + +Create your Dockerfile like below. + +```Dockerfile +FROM uphy/novnc-alpine +RUN \ + # Install xterm + apk add xterm && \ + # Append xterm entry to supervisord.conf + cd /etc/supervisor/conf.d && \ + echo '[program:xterm]' >> supervisord.conf && \ + echo 'command=xterm' >> supervisord.conf && \ + echo 'autorestart=true' >> supervisord.conf +``` + +Build and run the image. + +```bash +$ docker build -t mynovnc . +$ docker run -it --rm -p 8080:8080 mynovnc +``` + +Open the browser http://localhost:8080. +Click 'Connect'. +Then you can see xterm. \ No newline at end of file diff --git a/makefile b/makefile new file mode 100644 index 0000000..a513e04 --- /dev/null +++ b/makefile @@ -0,0 +1,49 @@ +######################################### +#VARIABLES: CAN BE EDITED +######################################### + +CONTAINER=novnc + +CONTNAME=$(CONTAINER)-1 + +DATAVOL=/home/docker/$(CONTAINER)/vol + + +#net=host: mandatory for others containers to connect to mysql +STARTOPT=-d \ +-p 8091:8080 \ +-v $(DATAVOL):/root \ +--name $(CONTNAME) \ +$(CONTAINER) + + +######################################### +# ACTIONS: DO NOT EDIT BEYOND THIS POINT +######################################### + +build: + docker build -t $(CONTAINER) . + +run: + docker run $(STARTOPT) + +bash: + docker exec -i -t $(CONTNAME) /bin/bash + +stop: + docker stop $(CONTNAME) + +delete: + docker rm $(CONTNAME) + +clear: + docker rmi -f $(CONTAINER) + +install: + docker run --restart=always $(STARTOPT) + +cleanupdb: + make stop;make delete + +restart: + make stop;make delete ;make build ;make run diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..cc0af8f --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,23 @@ +[supervisord] +nodaemon=true + +[program:X11] +command=Xvfb :0 -screen 0 "%(ENV_DISPLAY_WIDTH)s"x"%(ENV_DISPLAY_HEIGHT)s"x24 +autorestart=true + +[program:x11vnc] +command=/usr/bin/x11vnc +autorestart=true + +[program:novnc] +command=/opt/noVNC/utils/launch.sh --vnc localhost:5900 --listen 8080 +autorestart=true + +#[program:novnc] +#command=/opt/noVNC/utils/launch.sh --vnc benux.mailliet.ovh:5901 --listen 8081 +#autorestart=true + +[program:fluxbox] +command=fluxbox +autorestart=true +