diff --git a/images/vnc/Dockerfile.ubuntu b/images/vnc/Dockerfile.ubuntu index 8a58d1e..e62340c 100644 --- a/images/vnc/Dockerfile.ubuntu +++ b/images/vnc/Dockerfile.ubuntu @@ -100,7 +100,8 @@ RUN find $VNC_SETUP_SCRIPTS -name '*.sh' -exec chmod a+x {} + RUN $VNC_SETUP_SCRIPTS/set_user_permission.sh $VNC_ROOT_DIR \ && chmod +x $VNC_XSTARTUP -COPY ["configure", "/coder/configure"] +# Add Coder-specific scripts and metadata to the image +COPY ["./coder", "/coder"] RUN chmod +x /coder/configure USER coder diff --git a/images/vnc/README.md b/images/vnc/README.md index a611e25..6033075 100644 --- a/images/vnc/README.md +++ b/images/vnc/README.md @@ -4,13 +4,18 @@ A [sample image](https://github.com/cdr/enterprise-images/tree/main/images/vnc) ## To connect -- Option 1 (Web): Create a dev URL on port `6081` and navigate to it -- Option 2 (SSH Tunneling): Use SSH tunneling to expose the VNC server to your local machine. You will need the [coder-cli](https://github.com/cdr/coder-cli) and a VNC client installed on your local machine. +- Option 1 (Web): Click the "Desktop" application from the Coder dashboard on any workspace that uses this VNC image. + + ![VNC application screenshot](./example.png) + +- Option 2 (SSH Tunneling): Connect from your local VNC Client. Expose the VNC server to your local machine. You will need the [coder-cli](https://github.com/cdr/coder-cli) and any VNC client installed on your local machine. ```sh coder config-ssh # Forward the remote VNC server to your local machine - ssh -L -N 5990:localhost:5990 coder.[env-name] + coder tunnel vnc-ux 5990 5990 # You will not see any output if it succeeds, but you # will be able to connect your VNC client to localhost:5990 ``` + +- Option 3 (Web): Create a dev URL on port `6081` and navigate to it diff --git a/images/vnc/coder/apps/config.yaml b/images/vnc/coder/apps/config.yaml new file mode 100644 index 0000000..4e71b26 --- /dev/null +++ b/images/vnc/coder/apps/config.yaml @@ -0,0 +1,21 @@ +# Adds a "Desktop" app to this workspace in the Coder dashboard +apps: + - name: Desktop + scheme: http + port: 6081 + # Working directory + working-directory: /home/coder + # File path to icon used in application launcher + icon-path: /coder/apps/desktop.png + # VNC server will be started by default in this image + command: supervisorctl + # Array of arguments for command + args: ["start", "vncserver"] + health-check: + exec: + command: "supervisorctl" + args: ["status", "vncserver"] + http: + scheme: "http" + path: "/" + port: 6081 diff --git a/images/vnc/coder/apps/desktop.png b/images/vnc/coder/apps/desktop.png new file mode 100644 index 0000000..3f2a1b2 Binary files /dev/null and b/images/vnc/coder/apps/desktop.png differ diff --git a/images/vnc/configure b/images/vnc/coder/configure similarity index 100% rename from images/vnc/configure rename to images/vnc/coder/configure diff --git a/images/vnc/example.png b/images/vnc/example.png new file mode 100644 index 0000000..a82411a Binary files /dev/null and b/images/vnc/example.png differ diff --git a/images/vnc/vnc/index.html b/images/vnc/vnc/index.html new file mode 100644 index 0000000..73c88f2 --- /dev/null +++ b/images/vnc/vnc/index.html @@ -0,0 +1,50 @@ + + + + + + + VNC Desktop + + + + + + + + + diff --git a/images/vnc/vnc/setup/no_vnc.sh b/images/vnc/vnc/setup/no_vnc.sh index 3790473..d91b109 100644 --- a/images/vnc/vnc/setup/no_vnc.sh +++ b/images/vnc/vnc/setup/no_vnc.sh @@ -7,5 +7,5 @@ wget -qO- https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz | tar xz --strip wget -qO- https://github.com/novnc/websockify/archive/v0.9.0.tar.gz | tar xz --strip 1 -C "$NO_VNC_HOME/utils/websockify" chmod +x -v "$NO_VNC_HOME"/utils/*.sh -## Create index.html to forward automatically to `vnc.html` -ln -s "$NO_VNC_HOME/vnc.html" "$NO_VNC_HOME/index.html" +# Add our index with settings optimized for Coder +ln -s "$VNC_ROOT_DIR/index.html" "$NO_VNC_HOME/index.html" \ No newline at end of file