Skip to content

Commit

Permalink
use websockify
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhotio committed Apr 29, 2024
1 parent 24d0225 commit cd80360
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 33 deletions.
5 changes: 2 additions & 3 deletions linux-amd64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ ARG UPSTREAM_IMAGE
ARG UPSTREAM_DIGEST_AMD64

FROM ${UPSTREAM_IMAGE}@${UPSTREAM_DIGEST_AMD64}
EXPOSE 6081
ARG IMAGE_STATS
ENV IMAGE_STATS=${IMAGE_STATS} WEBUI_PORTS="6081/tcp,6081/udp"
ENV IMAGE_STATS=${IMAGE_STATS} VNC_SERVER="host.docker.internal" VNC_PORT_SLOT="0"

RUN apk add --no-cache nginx websockify
RUN apk add --no-cache websockify

ARG VERSION
RUN curl -fsSL "https://github.com/novnc/noVNC/archive/refs/tags/v${VERSION}.tar.gz" | tar xzf - -C "${APP_DIR}" --strip-components=1
Expand Down
5 changes: 2 additions & 3 deletions linux-arm64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ ARG UPSTREAM_IMAGE
ARG UPSTREAM_DIGEST_ARM64

FROM ${UPSTREAM_IMAGE}@${UPSTREAM_DIGEST_ARM64}
EXPOSE 6081
ARG IMAGE_STATS
ENV IMAGE_STATS=${IMAGE_STATS} WEBUI_PORTS="6081/tcp,6081/udp"
ENV IMAGE_STATS=${IMAGE_STATS} VNC_SERVER="host.docker.internal" VNC_PORT_SLOT="0"

RUN apk add --no-cache nginx websockify
RUN apk add --no-cache websockify

ARG VERSION
RUN curl -fsSL "https://github.com/novnc/noVNC/archive/refs/tags/v${VERSION}.tar.gz" | tar xzf - -C "${APP_DIR}" --strip-components=1
Expand Down
23 changes: 0 additions & 23 deletions root/app/nginx.conf

This file was deleted.

3 changes: 2 additions & 1 deletion root/etc/s6-overlay/s6-rc.d/init-setup-app/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ echo "
----------------------------------------------------------------------
ENVIRONMENT APP
----------------------------------------------------------------------
WEBUI_PORTS=${WEBUI_PORTS}
VNC_SERVER=${VNC_SERVER}
VNC_PORT_SLOT=${VNC_PORT_SLOT}
----------------------------------------------------------------------
"
6 changes: 3 additions & 3 deletions root/etc/s6-overlay/s6-rc.d/service-novnc/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

umask "${UMASK}"

readarray -td, PORTS <<< "${WEBUI_PORTS}"
sed -i "s/0.0.0.0:6081/0.0.0.0:${PORTS[0]%%/*}/" "${APP_DIR}/nginx.conf"
vnc_port=$(( 5900 + VNC_PORT_SLOT ))
novnc_port=$(( 6080 + VNC_PORT_SLOT ))

exec s6-setuidgid hotio nginx -c "${APP_DIR}/nginx.conf" -p "${CONFIG_DIR}" -e "error.log" -g "daemon off;pid nginx.pid;"
exec s6-setuidgid hotio "${APP_DIR}/utils/novnc_proxy" --vnc "${VNC_SERVER}:${vnc_port}" --listen "0.0.0.0:${novnc_port}"

0 comments on commit cd80360

Please sign in to comment.