Skip to content

Commit

Permalink
v0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vital987 committed May 2, 2024
1 parent 4ca4eda commit af06458
Show file tree
Hide file tree
Showing 58 changed files with 173 additions and 88 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
.gitattributes
.gitignore
.github/

app.json
heroku.yml
Makefile
Dockerfile.heroku
CHANGELOG.md
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.vscode/
.vagrant*
bin
docker/docker
.*.swp
a.out
*.orig
build_src
.flymake*
.idea
.DS_Store
docs/_build
docs/_static
docs/_templates
.gopath/
.dotcloud
*.test
bundles/
.hg/
vendor/pkg/
pyenv
Vagrantfile
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Changelog

## 0.12.0 - 2024-05-02

### Added

- CHANGELOG.md
- .gitignore
- Makefile
- docker-compose.yml
- --disable-gpu flag to chrome
- missing python requests module required for self-ping.py ([#7](https://github.com/vital987/chrome-novnc/issues/7) fix)
- VNC_SHARED to app.json

### Changed

- base distro to alpine
- package names for alpine compatibility
- chromium download source to alpine repo
- README.md
- rootfs -> assets

### Fixed

- issue [#7](https://github.com/vital987/chrome-novnc/issues/7)

45 changes: 18 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
FROM ubuntu:22.04
FROM alpine:3.19.1

LABEL AboutImage "Ubuntu22.04_Chromium_NoVNC"
LABEL AboutImage "Alpine_Chromium_NoVNC"

LABEL Maintainer "Apoorv Vyavahare <[email protected]>"

ARG DEBIAN_FRONTEND=noninteractive
LABEL Maintainer "Apurv Vyavahare <[email protected]>"

#VNC Server Password
ENV VNC_PASS="samplepass" \
ENV VNC_PASS="CHANGE_IT" \
#VNC Server Title(w/o spaces)
VNC_TITLE="Chromium" \
#VNC Resolution(720p is preferable)
VNC_RESOLUTION="1280x720" \
#VNC Shared Mode (0=off, 1=on)
VNC_SHARED=0 \
#VNC Shared Mode
VNC_SHARED=false \
#Local Display Server Port
DISPLAY=:0 \
#NoVNC Port
NOVNC_PORT=$PORT \
PORT=8080 \
#Heroku No-Sleep Mode
NO_SLEEP=false \
#Locale
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
TZ="Asia/Kolkata"

COPY rootfs/ /

SHELL ["/bin/bash", "-c"]
COPY assets/ /

RUN apt-get update && \
apt-get install -y tzdata ca-certificates supervisor curl wget python3 python3-pip sed unzip xvfb x11vnc websockify openbox libnss3 libgbm-dev libasound2 fonts-droid-fallback && \
#Chromium
wget https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1235467%2Fchrome-linux.zip?alt=media -O /tmp/chrome-linux.zip && \
unzip /tmp/chrome-linux.zip -d /opt && \
#noVNC
openssl req -new -newkey rsa:4096 -days 36500 -nodes -x509 -subj "/C=IN/ST=Maharastra/L=Private/O=Dis/CN=www.google.com" -keyout /etc/ssl/novnc.key -out /etc/ssl/novnc.cert && \
#TimeZone
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
RUN apk update && \
apk add --no-cache tzdata ca-certificates supervisor curl wget openssl bash python3 py3-requests sed unzip xvfb x11vnc websockify openbox chromium nss alsa-lib font-noto && \
# noVNC SSL certificate
openssl req -new -newkey rsa:4096 -days 36500 -nodes -x509 -subj "/C=IN/O=Dis/CN=www.google.com" -keyout /etc/ssl/novnc.key -out /etc/ssl/novnc.cert > /dev/null 2>&1 && \
# TimeZone
cp /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone && \
#Wipe Temp Files
rm -rf /var/lib/apt/lists/* && \
apt-get remove -y wget python3-pip unzip && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf /tmp/*

# Wipe Temp Files
apk del build-base curl wget unzip tzdata openssl && \
rm -rf /var/cache/apk/* /tmp/*
ENTRYPOINT ["supervisord", "-l", "/var/log/supervisord.log", "-c"]

CMD ["/config/supervisord.conf"]
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
USR=vital987
NAME=chrome-novnc
TAG=latest
IMG=${USR}/${NAME}:${TAG}

build: clean
docker build --tag ${IMG} --no-cache .

up:
docker-compose up

down:
docker-compose down

clean:
docker stop ${IMG} 2>/dev/null || :
docker rm ${IMG} 2>/dev/null || :
docker rmi ${IMG} 2>/dev/null || :
47 changes: 25 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# Chromium with NoVNC

## Warning
This project runs Chromium directly as the root user without sandboxing. Avoid deploying it in production environments.
## Installation
- ### Heroku
[![Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/vital987/chrome-novnc)

## Heroku installation
[![Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/vital987/chrome-novnc)
- ### Manual
- ```sh
HOST_PORT=8080 VNC_PASS=CHANGE_IT docker-compose up -d
```
- ```sh
docker run \
--name chrome-novnc \
-e PORT=8080 \
-p 8080:8080 \
-e VNC_PASS=CHANGE_IT \
vital987/chrome-novnc:latest
```

## Manual installation
```bash
docker run \
--name chrome-novnc \
-e PORT=9870 \
-p 9870:9870 \
-e VNC_PASS=TestPass987 \
vital987/chrome-novnc:latest
```

## Environment variables:
| PORT | NoVNC HTTPS Port (Default: 9870) |
|:--------------:|:--------------------------------------------------------------:|
| VNC_PASS | VNC Password (Default: samplepass) |
| VNC_TITLE | VNC Session Title (Default: Chromium) |
| VNC_RESOLUTION | VNC Resolution (Default: 1280x720) |
| APP_NAME | Name of the app (Heroku specific) |
| NO_SLEEP | Prevent app from sleeping (Heroku specific, default: disabled) |
## Environment variables:
|VARIABLE |DESCRIPTION |DEFAULT VALUE |
|-------------:|:------------------------|:-------------:|
|VNC_PASS |VNC Password |CHANGE_IT |
|VNC_TITLE |VNC Session Title |Chromium |
|VNC_SHARED |VNC Shared Mode |false |
|VNC_RESOLUTION|VNC Resolution |1280x720 |
|PORT |NoVNC HTTPS Port |Heroku specific|
|APP_NAME |Name of the app |Heroku specific|
|NO_SLEEP |Prevent app from sleeping|Heroku specific|
57 changes: 32 additions & 25 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
{
"name":"Chromium-NoVNC",
"description":"Chromium via NoVNC",
"repository":"https://github.com/vital987/chromium-novnc.git",
"logo":"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Google_Chrome_icon_%28September_2014%29.svg/2048px-Google_Chrome_icon_%28September_2014%29.svg.png",
"keywords":[
"name": "Chromium-NoVNC",
"description": "Chromium access with NoVNC",
"repository": "https://github.com/vital987/chrome-novnc.git",
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Google_Chrome_icon_%28September_2014%29.svg/2048px-Google_Chrome_icon_%28September_2014%29.svg.png",
"keywords": [
"docker",
"browser",
"chrome",
"chrome",
"heroku",
"novnc",
"vnc",
"firefox"
],
"stack":"container",
"env":{
"APP_NAME":{
"description":"Name of the app, same as mentioned above.",
"required":true
"stack": "container",
"env": {
"APP_NAME": {
"description": "Heroku application name",
"required": true
},
"VNC_TITLE": {
"description": "VNC session title",
"value": "Chromium",
"required": true
},
"VNC_TITLE":{
"description":"VNC Session Title, w/o spaces.",
"value":"Chromium",
"required":true
"VNC_PASS": {
"description": "VNC server password (8+ characters)",
"required": true
},
"VNC_PASS":{
"description":"VNC server password w/o spaces.",
"required":true
"VNC_RESOLUTION": {
"description": "VNC server resolution in WidthxHeight format (720p preferred)",
"value": "1280x720",
"required": true
},
"VNC_RESOLUTION":{
"description":"VNC Server Resolution in WxH, 720p is preferrable.",
"value":"1280x720",
"required":true
"VNC_SHARED": {
"description": "Run single instance on multiple devices",
"value": "false",
"required": true
},
"NO_SLEEP":{
"description":"Prevent app from sleeping, 1=on, 0=off",
"value":"0",
"required":true
"NO_SLEEP": {
"description": "Prevent app from sleeping",
"value": "false",
"required": true
}
}
}
2 changes: 1 addition & 1 deletion rootfs/config/self-ping.py → assets/config/self-ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import requests
from time import sleep
if __name__ == "__main__":
if os.getenv("NO_SLEEP") == "1":
if os.getenv("NO_SLEEP") == "true":
if "APP_NAME" not in os.environ:
print("APP_NAME unset, terminating...")
exit()
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions assets/config/supervisor/3-vnc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[program:VNC]
command=bash -c 'sed -i "s/\$DESKTOP/$VNC_TITLE/g" /opt/novnc/index.html && if ((VNC_SHARED==false)); then x11vnc -storepasswd $VNC_PASS /config/.xpass && x11vnc -usepw -rfbport 5900 -rfbauth /config/.xpass -geometry $VNC_RESOLUTION -forever -alwaysshared -permitfiletransfer -noxrecord -noxfixes -noxdamage -dpms -bg -desktop $VNC_TITLE; else x11vnc -storepasswd $VNC_PASS /config/.xpass && x11vnc -usepw -rfbport 5900 -rfbauth /config/.xpass -geometry $VNC_RESOLUTION -forever -shared -alwaysshared -permitfiletransfer -bg -desktop $VNC_TITLE; fi'
startsecs=0
autorestart=unexpected
stderr_logfile=/var/log/x11vnc.stderr.log
priority=3
File renamed without changes.
5 changes: 5 additions & 0 deletions assets/config/supervisor/5-chromium.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[program:Chromium]
command=bash -c 'chromium --no-sandbox --test-type --disable-dev-shm-usage --disable-gpu --start-maximized'
priority=5
autorestart=true
stderr_logfile=/var/log/chromium.err.log
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.4'

services:
chrome-novnc:
container_name: chrome-novnc
environment:
- VNC_PASS=${VNC_PASS-CHANGE_IT}
- VNC_TITLE=${VNC_TITLE-Chromium}
- VNC_SHARED=${VNC_SHARED-false}
- VNC_RESOLUTION=${VNC_RESOLUTION-1280x720}
- PORT=8080
image: vital987/chrome-novnc:latest
ports:
- "${HOST_PORT-8080}:8080/tcp"
restart: always
6 changes: 0 additions & 6 deletions rootfs/config/supervisor/3-vnc.conf

This file was deleted.

6 changes: 0 additions & 6 deletions rootfs/config/supervisor/5-chromium.conf

This file was deleted.

0 comments on commit af06458

Please sign in to comment.