summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Cacheiro <javier.cacheiro.lopez@cesga.es>2022-04-13 19:33:21 +0200
committerJavier Cacheiro <javier.cacheiro.lopez@cesga.es>2022-04-22 13:21:57 +0200
commitdec26a6a2d3cb44a841ddf2bf60ea3018fa8457c (patch)
treea77d32d3855a86ced4b70c65a24ecb64cf914b91
parente4cff3746ddb49f7b8fc604f0ac736c2e52cef95 (diff)
downloadwebsockify-dec26a6a2d3cb44a841ddf2bf60ea3018fa8457c.tar.gz
Docker support
-rw-r--r--README.md33
-rw-r--r--docker/Dockerfile21
-rwxr-xr-xdocker/docker-entrypoint.sh6
3 files changed, 60 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1922b4c..060187f 100644
--- a/README.md
+++ b/README.md
@@ -168,3 +168,36 @@ before running `python3 setup.py install`.
Afterwards, websockify should be available in your path. Run
`websockify --help` to confirm it's installed correctly.
+
+
+### Running with Docker/Podman
+You can also run websockify using Docker, Podman, Singularity, udocker or
+your favourite container runtime that support OCI container images.
+
+The entrypoint of the image is the `run` command.
+
+To build the image:
+```
+cd docker
+docker build -t novnc/websockify .
+```
+
+Once built you can just launch it with the same
+arguments you would give to the `run` command and taking care of
+assigning the port mappings:
+```
+docker run -it --rm -p <port>:<container_port> novnc/websockify <container_port> <run_arguments>
+```
+
+For example to forward traffic from local port 7000 to 10.1.1.1:5902
+you can use:
+```
+docker run -it --rm -p 7000:80 novnc/websockify 80 10.1.1.1:5902
+```
+
+If you need to include files, like for example for the `--web` or `--cert`
+options you can just mount the required files in the `/data` volume and then
+you can reference them in the usual way:
+```
+docker run -it --rm -p 443:443 -v websockify-data:/data novnc/websockify --cert /data/self.pem --web /data/noVNC :443 --token-plugin TokenRedis --token-source myredis.local:6379 --ssl-only --ssl-version tlsv1_2
+```
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..535b163
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,21 @@
+FROM python:3.6
+
+ENV VERSION 0.10.0
+
+RUN mkdir -p /opt/websockify \
+ && curl -SL https://github.com/novnc/websockify/archive/refs/tags/v$VERSION.tar.gz \
+ | tar xzC /opt/websockify
+
+RUN python -m pip install 'numpy<1.17' redis simplejson jwcrypto
+
+VOLUME /data
+
+EXPOSE 80
+EXPOSE 443
+
+WORKDIR /opt/websockify
+
+COPY docker-entrypoint.sh /
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["--help"]
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
new file mode 100755
index 0000000..1178553
--- /dev/null
+++ b/docker/docker-entrypoint.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+set -e
+
+/opt/websockify/websockify-$VERSION/run "$@"