Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whimsical-c4lic0 committed Feb 23, 2024
1 parent 5b50064 commit ba5c2ac
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Docker image

on:
push:
branches:
- 'main'
schedule:
- cron: 0 0 * * 0 # Weekly
workflow_dispatch:

jobs:
push_to_registry:
name: Push docker image to registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.actor }}/novnc:latest

30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM alpine:latest

ARG NON_ROOT_USER=novnc

# Install noVNC and supervisor
RUN apk upgrade --no-cache
RUN apk add --no-cache \
novnc \
supervisor

# Redirect webroot to vnc.html instead of displaying directory listing
RUN echo "<!DOCTYPE html><html><head><meta http-equiv=\"Refresh\" content=\"0; url='vnc.html'\" /></head><body></body></html>" > /usr/share/novnc/index.html

# Copy the supervisord config
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Create a non-root user
RUN addgroup -S $NON_ROOT_USER && adduser -S $NON_ROOT_USER -G $NON_ROOT_USER

# Create app directory owned by the non-root user
RUN mkdir /app
RUN chown $NON_ROOT_USER:$NON_ROOT_USER /app
WORKDIR /app

USER $NON_ROOT_USER

EXPOSE 8080

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# noVNC Docker Image

This image is intended to be used as a VNC client to connect to existing VNC servers.

## Usage

A VNC server must be set using the `VNC_SERVER` environment variable. Both the host and port must be defined. The noVNC is available on the container's port 8080.

For example, if you wanted to run noVNC on your localhost port `3000` to connect to a VNC server hosted at `192.168.1.200` on port `5900`, you'd run the following command:

`docker run --rm -p 3000:8080 -e VNC_SERVER=192.168.1.200:5900 ghrc.io/whimsical-c4lic0/vnc:latest`

## Image Contents

- [Alpine Linux](https://www.alpinelinux.org) - A lightweight Linux distribution to serve as the image base
- [noVNC](https://novnc.com) - An HTML5 canvas VNC viewer
- [supervisord](http://supervisord.org) - A process control system for managing the noVNC server

## Attributions

This image is a simplified version of the [noVNC image](https://github.com/psharkey/docker/tree/master/novnc) by Pat Sharkey ([@psharkey](https://github.com/psharkey)). I just needed a VNC client without x11.

7 changes: 7 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[supervisord]
nodaemon=true

[program:websockify]
command=websockify --web /usr/share/novnc 8080 %(ENV_VNC_SERVER)s
autorestart=true

0 comments on commit ba5c2ac

Please sign in to comment.