diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 5171e9d..0000000 --- a/.drone.yml +++ /dev/null @@ -1,86 +0,0 @@ -# -# Drone pipeline to build Docker image. -# - -kind: pipeline -type: docker -name: default - -steps: - -- name: build-only - image: plugins/docker - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - build_args: - - DOCKER_IMAGE_VERSION=drone-ci - dry_run: true - when: - ref: - exclude: - - refs/tags/v* - -- name: set-docker-tags - image: alpine - commands: - # Always tag the Docker image with the Git tag (i.e. vX.Y.Z). - - printf "${DRONE_TAG}" >> .tags - # Tag the Docker image with with 'latest' only if not a prerelease. - - printf "${DRONE_TAG}" | grep -q '-' || printf ",latest" >> .tags - when: - ref: - - refs/tags/v* - -- name: build-and-push - image: plugins/docker - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - username: - from_secret: dockerhub_username - password: - from_secret: dockerhub_password - build_args: - - DOCKER_IMAGE_VERSION=${DRONE_TAG:1} - when: - ref: - - refs/tags/v* - -- name: push-dockerhub-readme - image: jlesage/drone-push-readme - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - username: - from_secret: dockerhub_username - password: - from_secret: dockerhub_password - readme: DOCKERHUB.md - when: - ref: - - refs/tags/v* - -- name: microbadger - image: plugins/webhook - settings: - urls: - from_secret: microbadger_webhook - failure: ignore - when: - ref: - - refs/tags/v* - -- name: notification - image: plugins/pushover - settings: - message: "{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }} ({{ build.branch }}) by {{ build.author }} - {{ build.message }}" - token: - from_secret: pushover_token - user: - from_secret: pushover_user - failure: ignore - when: - event: - exclude: - - pull_request - status: - - success - - failure diff --git a/.github/workflows/anchore-analysis.yml b/.github/workflows/anchore-analysis.yml deleted file mode 100644 index f856e25..0000000 --- a/.github/workflows/anchore-analysis.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This workflow checks out code, builds an image, performs a container image -# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security -# code scanning feature. For more information on the Anchore scan action usage -# and parameters, see https://github.com/anchore/scan-action. For more -# information on Anchore's container image scanning tool Grype, see -# https://github.com/anchore/grype -name: Anchore Container Scan 2 -on: push -jobs: - Anchore-Build-Scan: - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v2 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag localbuild/testimage:latest - - name: Run the Anchore scan action itself with GitHub Advanced Security code scanning integration enabled - uses: anchore/scan-action@main - with: - image: "localbuild/testimage:latest" - acs-report-enable: true - - name: Upload Anchore Scan Report - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: results.sarif diff --git a/.github/workflows/github_package_repository.yml b/.github/workflows/github_package_repository.yml index 3ed2987..6f79291 100644 --- a/.github/workflows/github_package_repository.yml +++ b/.github/workflows/github_package_repository.yml @@ -1,32 +1,49 @@ name: Publish Docker image to GitHub Package Registry -on: push + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: {} + schedule: + - cron: '30 22 * * 3' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - build: - runs-on: ubuntu-latest + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: + + - name: Checkout repository + uses: actions/checkout@v2 - - name: Checkout Master - uses: actions/checkout@master + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - #This Action Emits 2 Variables, IMAGE_SHA_NAME and IMAGE_URL - #which you can reference in subsequent steps - - name: Publish Docker Image to GPR - uses: machine-learning-apps/gpr-docker-publish@master - id: docker - with: - IMAGE_NAME: 'docker-chromium' - TAG: 'latest' - DOCKERFILE_PATH: 'Dockerfile' - BUILD_CONTEXT: '.' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ github.repository }} - # This second step is illustrative and shows how to reference the - # output variables. This is completely optional. - - name: Show outputs of previous step - run: | - echo "The name:tag of the Docker Image is: $VAR1" - echo "The docker image is hosted at $VAR2" - env: - VAR1: ${{ steps.docker.outputs.IMAGE_SHA_NAME }} - VAR2: ${{ steps.docker.outputs.IMAGE_URL }} + - name: Build and push Docker image + id: publish + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 197c633..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# -# Travis CI recipe to build docker image. -# - -sudo: required - -language: generic - -services: - - docker - -script: - - echo "Starting build of Docker image..." - - docker build --no-cache --pull -t $TRAVIS_REPO_SLUG:$TRAVIS_JOB_ID . diff --git a/DOCKERHUB.md b/DOCKERHUB.md deleted file mode 100644 index 8424660..0000000 --- a/DOCKERHUB.md +++ /dev/null @@ -1,484 +0,0 @@ -# Docker container for Chromium - -This is a Docker container for Chromium. - -The GUI of the application is accessed through a modern web browser (no installation or configuration needed on client side) or via any VNC client. - ---- - -Big thanks to @jlesage. This image is based off https://github.com/jlesage/docker-firefox - -___ - -[![Chromium](https://dummyimage.com/400x110/ffffff/575757&text=Chromium) - -Mozilla Chromium is a free and open-source web browser developed by Mozilla Foundation and its subsidiary, Mozilla Corporation. - ---- - -## Table of Content - - * [Docker container for Chromium](#docker-container-for-chromium) - * [Table of Content](#table-of-content) - * [Quick Start](#quick-start) - * [Usage](#usage) - * [Environment Variables](#environment-variables) - * [Data Volumes](#data-volumes) - * [Ports](#ports) - * [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container) - * [Docker Compose File](#docker-compose-file) - * [Docker Image Update](#docker-image-update) - * [Synology](#synology) - * [unRAID](#unraid) - * [User/Group IDs](#usergroup-ids) - * [Accessing the GUI](#accessing-the-gui) - * [Security](#security) - * [SSVNC](#ssvnc) - * [Certificates](#certificates) - * [VNC Password](#vnc-password) - * [Reverse Proxy](#reverse-proxy) - * [Routing Based on Hostname](#routing-based-on-hostname) - * [Routing Based on URL Path](#routing-based-on-url-path) - * [Shell Access](#shell-access) - * [Increasing Shared Memory Size](#increasing-shared-memory-size) - * [Sound Support](#sound-support) - * [Setting Chromium Preferences Via Environment Variables](#setting-chromium-preferences-via-environment-variables) - * [Troubleshooting](#troubleshooting) - * [Crashes](#crashes) - * [Support or Contact](#support-or-contact) - -## Quick Start - -**NOTE**: The Docker command provided in this quick start is given as an example -and parameters should be adjusted to your need. - -Launch the Chromium docker container with the following command: -``` -docker run -d \ - --name=chromium \ - -p 5800:5800 \ - -v /docker/appdata/chromium:/config:rw \ - --shm-size 2g \ - overclockedllama/docker-chromium -``` - -Where: - - `/docker/appdata/chromium`: This is where the application stores its configuration, log and any files needing persistency. - -Browse to `http://your-host-ip:5800` to access the Chromium GUI. - -## Usage - -``` -docker run [-d] \ - --name=chromium \ - [-e =]... \ - [-v :[:PERMISSIONS]]... \ - [-p :]... \ - --shm-size VALUE \ - overclockedllama/docker-chromium -``` -| Parameter | Description | -|-----------|-------------| -| -d | Run the container in background. If not set, the container runs in foreground. | -| -e | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details. | -| -v | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. | -| -p | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details. | -| --shm-size | Set the size of `/dev/shm` to `VALUE`. The format of `VALUE` is ``, where `number` must be greater than `0` and `unit` can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). **NOTE**: To avoid crashes, it is recommended to set this value to `2g`. | - -### Environment Variables - -To customize some properties of the container, the following environment -variables can be passed via the `-e` parameter (one for each variable). Value -of this parameter has the format `=`. - -| Variable | Description | Default | -|----------------|----------------------------------------------|---------| -|`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | -|`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | -|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (unset) | -|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, this variable is not set and the default umask of `022` is used, meaning that newly created files are readable by everyone, but only writable by the owner. See the following online umask calculator: http://wintelguy.com/umask-calc.pl | (unset) | -|`TZ`| [TimeZone] of the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` | -|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted if it crashes or if user quits it. | `0` | -|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. By default, niceness is not set, meaning that the default niceness of 0 is used. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | (unset) | -|`CLEAN_TMP_DIR`| When set to `1`, all files in the `/tmp` directory are delete during the container startup. | `1` | -|`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1280` | -|`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `768` | -|`SECURE_CONNECTION`| When set to `1`, an encrypted connection is used to access the application's GUI (either via web browser or VNC client). See the [Security](#security) section for more details. | `0` | -|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (unset) | -|`X11VNC_EXTRA_OPTS`| Extra options to pass to the x11vnc server running in the Docker container. **WARNING**: For advanced users. Do not use unless you know what you are doing. | (unset) | -|`ENABLE_CJK_FONT`| When set to `1`, open source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` | - -### Data Volumes - -The following table describes data volumes used by the container. The mappings -are set via the `-v` parameter. Each mapping is specified with the following -format: `:[:PERMISSIONS]`. - -| Container path | Permissions | Description | -|-----------------|-------------|-------------| -|`/config`| rw | This is where the application stores its configuration, log and any files needing persistency. | - -### Ports - -Here is the list of ports used by the container. They can be mapped to the host -via the `-p` parameter (one per port mapping). Each mapping is defined in the -following format: `:`. The port number inside the -container cannot be changed, but you are free to use any port on the host side. - -| Port | Mapping to host | Description | -|------|-----------------|-------------| -| 5800 | Mandatory | Port used to access the application's GUI via the web interface. | -| 5900 | Optional | Port used to access the application's GUI via the VNC protocol. Optional if no VNC client is used. | - -### Changing Parameters of a Running Container - -As seen, environment variables, volume mappings and port mappings are specified -while creating the container. - -The following steps describe the method used to add, remove or update -parameter(s) of an existing container. The generic idea is to destroy and -re-create the container: - - 1. Stop the container (if it is running): -``` -docker stop chromium -``` - 2. Remove the container: -``` -docker rm chromium -``` - 3. Create/start the container using the `docker run` command, by adjusting - parameters as needed. - -**NOTE**: Since all application's data is saved under the `/config` container -folder, destroying and re-creating a container is not a problem: nothing is lost -and the application comes back with the same state (as long as the mapping of -the `/config` folder remains the same). - -## Docker Compose File - -Here is an example of a `docker-compose.yml` file that can be used with -[Docker Compose](https://docs.docker.com/compose/overview/). - -Make sure to adjust according to your needs. Note that only mandatory network -ports are part of the example. - -```yaml -version: '3' -services: - chromium: - image: overclockedllama/docker-chromium - build: . - ports: - - "5800:5800" - volumes: - - "/docker/appdata/chromium:/config:rw" -``` - -## Docker Image Update - -If the system on which the container runs doesn't provide a way to easily update -the Docker image, the following steps can be followed: - - 1. Fetch the latest image: -``` -docker pull overclockedllama/docker-chromium -``` - 2. Stop the container: -``` -docker stop chromium -``` - 3. Remove the container: -``` -docker rm chromium -``` - 4. Start the container using the `docker run` command. - -### Synology - -For owners of a Synology NAS, the following steps can be use to update a -container image. - - 1. Open the *Docker* application. - 2. Click on *Registry* in the left pane. - 3. In the search bar, type the name of the container (`overclockedllama/docker-chromium`). - 4. Select the image, click *Download* and then choose the `latest` tag. - 5. Wait for the download to complete. A notification will appear once done. - 6. Click on *Container* in the left pane. - 7. Select your Chromium container. - 8. Stop it by clicking *Action*->*Stop*. - 9. Clear the container by clicking *Action*->*Clear*. This removes the - container while keeping its configuration. - 10. Start the container again by clicking *Action*->*Start*. **NOTE**: The - container may temporarily disappear from the list while it is re-created. - -### unRAID - -For unRAID, a container image can be updated by following these steps: - - 1. Select the *Docker* tab. - 2. Click the *Check for Updates* button at the bottom of the page. - 3. Click the *update ready* link of the container to be updated. - -## User/Group IDs - -When using data volumes (`-v` flags), permissions issues can occur between the -host and the container. For example, the user within the container may not -exists on the host. This could prevent the host from properly accessing files -and folders on the shared volume. - -To avoid any problem, you can specify the user the application should run as. - -This is done by passing the user ID and group ID to the container via the -`USER_ID` and `GROUP_ID` environment variables. - -To find the right IDs to use, issue the following command on the host, with the -user owning the data volume on the host: - - id - -Which gives an output like this one: -``` -uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin) -``` - -The value of `uid` (user ID) and `gid` (group ID) are the ones that you should -be given the container. - -## Accessing the GUI - -Assuming that container's ports are mapped to the same host's ports, the -graphical interface of the application can be accessed via: - - * A web browser: -``` -http://:5800 -``` - - * Any VNC client: -``` -:5900 -``` - -## Security - -By default, access to the application's GUI is done over an unencrypted -connection (HTTP or VNC). - -Secure connection can be enabled via the `SECURE_CONNECTION` environment -variable. See the [Environment Variables](#environment-variables) section for -more details on how to set an environment variable. - -When enabled, application's GUI is performed over an HTTPs connection when -accessed with a browser. All HTTP accesses are automatically redirected to -HTTPs. - -When using a VNC client, the VNC connection is performed over SSL. Note that -few VNC clients support this method. [SSVNC] is one of them. - -[SSVNC]: http://www.karlrunge.com/x11vnc/ssvnc.html - -### SSVNC - -[SSVNC] is a VNC viewer that adds encryption security to VNC connections. - -While the Linux version of [SSVNC] works well, the Windows version has some -issues. At the time of writing, the latest version `1.0.30` is not functional, -as a connection fails with the following error: -``` -ReadExact: Socket error while reading -``` -However, for your convienence, an unoffical and working version is provided -here: - -https://github.com/jlesage/docker-baseimage-gui/raw/master/tools/ssvnc_windows_only-1.0.30-r1.zip - -The only difference with the offical package is that the bundled version of -`stunnel` has been upgraded to version `5.49`, which fixes the connection -problems. - -### Certificates - -Here are the certificate files needed by the container. By default, when they -are missing, self-signed certificates are generated and used. All files have -PEM encoded, x509 certificates. - -| Container Path | Purpose | Content | -|---------------------------------|----------------------------|---------| -|`/config/certs/vnc-server.pem` |VNC connection encryption. |VNC server's private key and certificate, bundled with any root and intermediate certificates.| -|`/config/certs/web-privkey.pem` |HTTPs connection encryption.|Web server's private key.| -|`/config/certs/web-fullchain.pem`|HTTPs connection encryption.|Web server's certificate, bundled with any root and intermediate certificates.| - -**NOTE**: To prevent any certificate validity warnings/errors from the browser -or VNC client, make sure to supply your own valid certificates. - -**NOTE**: Certificate files are monitored and relevant daemons are automatically -restarted when changes are detected. - -### VNC Password - -To restrict access to your application, a password can be specified. This can -be done via two methods: - * By using the `VNC_PASSWORD` environment variable. - * By creating a `.vncpass_clear` file at the root of the `/config` volume. - This file should contains the password in clear-text. During the container - startup, content of the file is obfuscated and moved to `.vncpass`. - -The level of security provided by the VNC password depends on two things: - * The type of communication channel (encrypted/unencrypted). - * How secure access to the host is. - -When using a VNC password, it is highly desirable to enable the secure -connection to prevent sending the password in clear over an unencrypted channel. - -**ATTENTION**: Password is limited to 8 characters. This limitation comes from -the Remote Framebuffer Protocol [RFC](https://tools.ietf.org/html/rfc6143) (see -section [7.2.2](https://tools.ietf.org/html/rfc6143#section-7.2.2)). Any -characters beyhond the limit are ignored. - -## Reverse Proxy - -The following sections contains NGINX configuration that need to be added in -order to reverse proxy to this container. - -A reverse proxy server can route HTTP requests based on the hostname or the URL -path. - -### Routing Based on Hostname - -In this scenario, each hostname is routed to a different application/container. - -For example, let's say the reverse proxy server is running on the same machine -as this container. The server would proxy all HTTP requests sent to -`chromium.domain.tld` to the container at `127.0.0.1:5800`. - -Here are the relevant configuration elements that would be added to the NGINX -configuration: - -``` -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} - -upstream docker-chromium { - # If the reverse proxy server is not running on the same machine as the - # Docker container, use the IP of the Docker host here. - # Make sure to adjust the port according to how port 5800 of the - # container has been mapped on the host. - server 127.0.0.1:5800; -} - -server { - [...] - - server_name chromium.domain.tld; - - location / { - proxy_pass http://docker-chromium; - } - - location /websockify { - proxy_pass http://docker-chromium; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 86400; - } -} - -``` - -### Routing Based on URL Path - -In this scenario, the hostname is the same, but different URL paths are used to -route to different applications/containers. - -For example, let's say the reverse proxy server is running on the same machine -as this container. The server would proxy all HTTP requests for -`server.domain.tld/chromium` to the container at `127.0.0.1:5800`. - -Here are the relevant configuration elements that would be added to the NGINX -configuration: - -``` -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} - -upstream docker-chromium { - # If the reverse proxy server is not running on the same machine as the - # Docker container, use the IP of the Docker host here. - # Make sure to adjust the port according to how port 5800 of the - # container has been mapped on the host. - server 127.0.0.1:5800; -} - -server { - [...] - - location = /chromium {return 301 $scheme://$http_host/chromium/;} - location /chromium/ { - proxy_pass http://docker-chromium/; - location /chromium/websockify { - proxy_pass http://docker-chromium/websockify/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 86400; - } - } -} - -``` -## Shell Access - -To get shell access to a the running container, execute the following command: - -``` -docker exec -it CONTAINER sh -``` - -Where `CONTAINER` is the ID or the name of the container used during its -creation (e.g. `crashplan-pro`). - -## Increasing Shared Memory Size - -To prevent crashes from happening when running Chromium -inside a Docker container, the size of the shared memory located at `/dev/shm` -must be increased. The issue is documented [here]. - -By default, the size is 64MB, which is not enough. It is recommended to use a -size of 2GB. This value is arbitrary, but known to work well. Setting the -size of `/dev/shm` can be done via two method: - - - By adding the `--shm-size 2g` parameter to the `docker run` command. See - the [Usage](#usage) section for more details. - - By using shared memory of the host, by mapping `/dev/shm` via the parameter - `-v /dev/shm:/dev/shm` of the `docker run` command. - -## Sound Support - -For Chromium to be able to use the audio device available on -the host, `/dev/snd` must be exposed to the container by adding the -`--device /dev/snd` parameter to the `docker run` command. - -## Troubleshooting - -### Crashes - -If Chromium is crashing frequently, make sure the size of -the shared memory located at `/dev/shm` has been increased. See -[Increasing Shared Memory Size](#increasing-shared-memory-size) section for more -details. - -## Support or Contact - -Having troubles with the container or have questions? Please -[create a new issue]. - -For other great Dockerized applications, see https://jlesage.github.io/docker-apps. - -[create a new issue]: https://github.com/overclockedllama/docker-chromium/issues diff --git a/Dockerfile b/Dockerfile index 92bd40d..80477de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,126 +1,32 @@ -# -# firefox Dockerfile -# -# https://github.com/jlesage/docker-firefox -# +FROM lsiobase/rdesktop-web:alpine -# Pull base image. -FROM jlesage/baseimage-gui:alpine-3.10-v3.5.3 - -# Docker image version is provided via build arg. -ARG DOCKER_IMAGE_VERSION=unknown - -# Define software versions. -ARG JSONLZ4_VERSION=c4305b8 -ARG LZ4_VERSION=1.8.1.2 -#ARG PROFILE_CLEANER_VERSION=2.36 - -# Define software download URLs. -ARG JSONLZ4_URL=https://github.com/avih/dejsonlz4/archive/${JSONLZ4_VERSION}.tar.gz -ARG LZ4_URL=https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz -#ARG PROFILE_CLEANER_URL=https://github.com/graysky2/profile-cleaner/raw/v${PROFILE_CLEANER_VERSION}/common/profile-cleaner.in # Define working directory. WORKDIR /tmp -# Install JSONLZ4 tools. -RUN \ - add-pkg --virtual build-dependencies \ - curl \ - build-base \ - && \ - mkdir jsonlz4 && \ - mkdir lz4 && \ - curl -# -L {$JSONLZ4_URL} | tar xz --strip 1 -C jsonlz4 && \ - curl -# -L {$LZ4_URL} | tar xz --strip 1 -C lz4 && \ - mv jsonlz4/src/ref_compress/*.c jsonlz4/src/ && \ - cp lz4/lib/lz4.* jsonlz4/src/ && \ - cd jsonlz4 && \ - gcc -static -Wall -o dejsonlz4 src/dejsonlz4.c src/lz4.c && \ - gcc -static -Wall -o jsonlz4 src/jsonlz4.c src/lz4.c && \ - strip dejsonlz4 jsonlz4 && \ - cp -v dejsonlz4 /usr/bin/ && \ - cp -v jsonlz4 /usr/bin/ && \ - cd .. && \ - # Cleanup. - del-pkg build-dependencies && \ - rm -rf /tmp/* /tmp/.[!.]* - -# Install Firefox. RUN \ - add-pkg --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \ - --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \ - --upgrade chromium - -# Install extra packages. -RUN \ - add-pkg \ - desktop-file-utils \ - adwaita-icon-theme \ - ttf-dejavu \ - ffmpeg-libs \ - # The following package is used to send key presses to the X process. - xdotool - -# Set default settings. -# RUN \ -# CFG_FILE="$(ls /usr/lib/firefox/browser/defaults/preferences/firefox-branding.js)" && \ -# echo '' >> "$CFG_FILE" && \ -# echo '// Default download directory.' >> "$CFG_FILE" && \ -# echo 'pref("browser.download.dir", "/config/downloads");' >> "$CFG_FILE" && \ -# echo 'pref("browser.download.folderList", 2);' >> "$CFG_FILE" - -# Install profile-cleaner. -#RUN \ -# add-pkg --virtual build-dependencies curl && \ -# curl -# -L -o /usr/bin/profile-cleaner {$PROFILE_CLEANER_URL} && \ -# sed-patch 's/@VERSION@/'${PROFILE_CLEANER_VERSION}'/' /usr/bin/profile-cleaner && \ -# chmod +x /usr/bin/profile-cleaner && \ -# add-pkg \ -# bash \ -# file \ -# coreutils \ -# bc \ -# parallel \ -# sqlite \ -# && \ -# # Cleanup. -# del-pkg build-dependencies && \ -# rm -rf /tmp/* /tmp/.[!.]* - -# Enable log monitoring. -RUN \ - add-pkg yad && \ - sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/chromium/error.log|' /etc/logmonitor/logmonitor.conf && \ - sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.chromium_shm_check|' /etc/logmonitor/logmonitor.conf - -# Adjust the openbox config. -RUN \ - # Maximize only the main window. - sed-patch 's///' \ - /etc/xdg/openbox/rc.xml && \ - # Make sure the main window is always in the background. - sed-patch '//a \ below' \ - /etc/xdg/openbox/rc.xml - -# Generate and install favicons. -RUN \ - APP_ICON_URL=https://www.chromium.org/_/rsrc/1438879449147/config/customLogo.gif && \ - install_app_icon.sh "$APP_ICON_URL" - -# Add files. -COPY rootfs/ / - -# Set environment variables. -ENV APP_NAME="Chromium" - -# Define mountable directories. -VOLUME ["/config"] - -# Metadata. -LABEL \ - org.label-schema.name="chromium" \ - org.label-schema.description="Docker container for Chromium" \ - org.label-schema.version="$DOCKER_IMAGE_VERSION" \ - org.label-schema.vcs-url="https://github.com/overclockedllama/docker-chromium" \ - org.label-schema.schema-version="1.0" + # chromium. + echo "**** install chromium ****" \ + && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories \ + && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ + && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && echo "http://dl-cdn.alpinelinux.org/alpine/v3.12/main" >> /etc/apk/repositories \ + && apk upgrade -U -a \ + && apk add \ + libstdc++ \ + chromium \ + harfbuzz \ + nss \ + freetype \ + ttf-freefont \ + font-noto-emoji \ + wqy-zenhei \ + && rm -rf /var/cache/* \ + && mkdir /var/cache/apk + +# add local files +COPY /root / + +# ports and volumes +EXPOSE 3000 +VOLUME /config diff --git a/README.md b/README.md deleted file mode 100644 index 8da2eb9..0000000 --- a/README.md +++ /dev/null @@ -1,484 +0,0 @@ -# Docker container for Chromium - - - -This is a Docker container for Chromium. - -The GUI of the application is accessed through a modern web browser (no installation or configuration needed on client side) or via any VNC client. - ---- - -Big thanks to @jlesage. This image is based off https://github.com/jlesage/docker-firefox - -___ - -![Chromium](https://dummyimage.com/400x110/ffffff/575757&text=Chromium) - ---- - -## Table of Content - - * [Docker container for Chromium](#docker-container-for-chromium) - * [Table of Content](#table-of-content) - * [Quick Start](#quick-start) - * [Usage](#usage) - * [Environment Variables](#environment-variables) - * [Data Volumes](#data-volumes) - * [Ports](#ports) - * [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container) - * [Docker Compose File](#docker-compose-file) - * [Docker Image Update](#docker-image-update) - * [Synology](#synology) - * [unRAID](#unraid) - * [User/Group IDs](#usergroup-ids) - * [Accessing the GUI](#accessing-the-gui) - * [Security](#security) - * [SSVNC](#ssvnc) - * [Certificates](#certificates) - * [VNC Password](#vnc-password) - * [Reverse Proxy](#reverse-proxy) - * [Routing Based on Hostname](#routing-based-on-hostname) - * [Routing Based on URL Path](#routing-based-on-url-path) - * [Shell Access](#shell-access) - * [Increasing Shared Memory Size](#increasing-shared-memory-size) - * [Sound Support](#sound-support) - * [Setting Chromium Preferences Via Environment Variables](#setting-chromium-preferences-via-environment-variables) - * [Troubleshooting](#troubleshooting) - * [Crashes](#crashes) - * [Support or Contact](#support-or-contact) - -## Quick Start - -**NOTE**: The Docker command provided in this quick start is given as an example -and parameters should be adjusted to your need. - -Launch the Chromium docker container with the following command: -``` -docker run -d \ - --name=chromium \ - -p 5800:5800 \ - -v /docker/appdata/chromium:/config:rw \ - --shm-size 2g \ - overclockedllama/docker-chromium -``` - -Where: - - `/docker/appdata/chromium`: This is where the application stores its configuration, log and any files needing persistency. - -Browse to `http://your-host-ip:5800` to access the Chromium GUI. - -## Usage - -``` -docker run [-d] \ - --name=chromium \ - [-e =]... \ - [-v :[:PERMISSIONS]]... \ - [-p :]... \ - --shm-size VALUE \ - overclockedllama/docker-chromium -``` -| Parameter | Description | -|-----------|-------------| -| -d | Run the container in background. If not set, the container runs in foreground. | -| -e | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details. | -| -v | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. | -| -p | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details. | -| --shm-size | Set the size of `/dev/shm` to `VALUE`. The format of `VALUE` is ``, where `number` must be greater than `0` and `unit` can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). **NOTE**: To avoid crashes, it is recommended to set this value to `2g`. | - -### Environment Variables - -To customize some properties of the container, the following environment -variables can be passed via the `-e` parameter (one for each variable). Value -of this parameter has the format `=`. - -| Variable | Description | Default | -|----------------|----------------------------------------------|---------| -|`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | -|`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | -|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (unset) | -|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, this variable is not set and the default umask of `022` is used, meaning that newly created files are readable by everyone, but only writable by the owner. See the following online umask calculator: http://wintelguy.com/umask-calc.pl | (unset) | -|`TZ`| [TimeZone] of the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` | -|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted if it crashes or if user quits it. | `0` | -|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. By default, niceness is not set, meaning that the default niceness of 0 is used. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | (unset) | -|`CLEAN_TMP_DIR`| When set to `1`, all files in the `/tmp` directory are delete during the container startup. | `1` | -|`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1280` | -|`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `768` | -|`SECURE_CONNECTION`| When set to `1`, an encrypted connection is used to access the application's GUI (either via web browser or VNC client). See the [Security](#security) section for more details. | `0` | -|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (unset) | -|`X11VNC_EXTRA_OPTS`| Extra options to pass to the x11vnc server running in the Docker container. **WARNING**: For advanced users. Do not use unless you know what you are doing. | (unset) | -|`ENABLE_CJK_FONT`| When set to `1`, open source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` | - -### Data Volumes - -The following table describes data volumes used by the container. The mappings -are set via the `-v` parameter. Each mapping is specified with the following -format: `:[:PERMISSIONS]`. - -| Container path | Permissions | Description | -|-----------------|-------------|-------------| -|`/config`| rw | This is where the application stores its configuration, log and any files needing persistency. | - -### Ports - -Here is the list of ports used by the container. They can be mapped to the host -via the `-p` parameter (one per port mapping). Each mapping is defined in the -following format: `:`. The port number inside the -container cannot be changed, but you are free to use any port on the host side. - -| Port | Mapping to host | Description | -|------|-----------------|-------------| -| 5800 | Mandatory | Port used to access the application's GUI via the web interface. | -| 5900 | Optional | Port used to access the application's GUI via the VNC protocol. Optional if no VNC client is used. | - -### Changing Parameters of a Running Container - -As seen, environment variables, volume mappings and port mappings are specified -while creating the container. - -The following steps describe the method used to add, remove or update -parameter(s) of an existing container. The generic idea is to destroy and -re-create the container: - - 1. Stop the container (if it is running): -``` -docker stop chromium -``` - 2. Remove the container: -``` -docker rm chromium -``` - 3. Create/start the container using the `docker run` command, by adjusting - parameters as needed. - -**NOTE**: Since all application's data is saved under the `/config` container -folder, destroying and re-creating a container is not a problem: nothing is lost -and the application comes back with the same state (as long as the mapping of -the `/config` folder remains the same). - -## Docker Compose File - -Here is an example of a `docker-compose.yml` file that can be used with -[Docker Compose](https://docs.docker.com/compose/overview/). - -Make sure to adjust according to your needs. Note that only mandatory network -ports are part of the example. - -```yaml -version: '3' -services: - chromium: - image: overclockedllama/docker-chromium - build: . - ports: - - "5800:5800" - volumes: - - "/docker/appdata/chromium:/config:rw" -``` - -## Docker Image Update - -If the system on which the container runs doesn't provide a way to easily update -the Docker image, the following steps can be followed: - - 1. Fetch the latest image: -``` -docker pull overclockedllama/docker-chromium -``` - 2. Stop the container: -``` -docker stop chromium -``` - 3. Remove the container: -``` -docker rm chromium -``` - 4. Start the container using the `docker run` command. - -### Synology - -For owners of a Synology NAS, the following steps can be use to update a -container image. - - 1. Open the *Docker* application. - 2. Click on *Registry* in the left pane. - 3. In the search bar, type the name of the container (`overclockedllama/docker-chromium`). - 4. Select the image, click *Download* and then choose the `latest` tag. - 5. Wait for the download to complete. A notification will appear once done. - 6. Click on *Container* in the left pane. - 7. Select your Chromium container. - 8. Stop it by clicking *Action*->*Stop*. - 9. Clear the container by clicking *Action*->*Clear*. This removes the - container while keeping its configuration. - 10. Start the container again by clicking *Action*->*Start*. **NOTE**: The - container may temporarily disappear from the list while it is re-created. - -### unRAID - -For unRAID, a container image can be updated by following these steps: - - 1. Select the *Docker* tab. - 2. Click the *Check for Updates* button at the bottom of the page. - 3. Click the *update ready* link of the container to be updated. - -## User/Group IDs - -When using data volumes (`-v` flags), permissions issues can occur between the -host and the container. For example, the user within the container may not -exists on the host. This could prevent the host from properly accessing files -and folders on the shared volume. - -To avoid any problem, you can specify the user the application should run as. - -This is done by passing the user ID and group ID to the container via the -`USER_ID` and `GROUP_ID` environment variables. - -To find the right IDs to use, issue the following command on the host, with the -user owning the data volume on the host: - - id - -Which gives an output like this one: -``` -uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin) -``` - -The value of `uid` (user ID) and `gid` (group ID) are the ones that you should -be given the container. - -## Accessing the GUI - -Assuming that container's ports are mapped to the same host's ports, the -graphical interface of the application can be accessed via: - - * A web browser: -``` -http://:5800 -``` - - * Any VNC client: -``` -:5900 -``` - -## Security - -By default, access to the application's GUI is done over an unencrypted -connection (HTTP or VNC). - -Secure connection can be enabled via the `SECURE_CONNECTION` environment -variable. See the [Environment Variables](#environment-variables) section for -more details on how to set an environment variable. - -When enabled, application's GUI is performed over an HTTPs connection when -accessed with a browser. All HTTP accesses are automatically redirected to -HTTPs. - -When using a VNC client, the VNC connection is performed over SSL. Note that -few VNC clients support this method. [SSVNC] is one of them. - -[SSVNC]: http://www.karlrunge.com/x11vnc/ssvnc.html - -### SSVNC - -[SSVNC] is a VNC viewer that adds encryption security to VNC connections. - -While the Linux version of [SSVNC] works well, the Windows version has some -issues. At the time of writing, the latest version `1.0.30` is not functional, -as a connection fails with the following error: -``` -ReadExact: Socket error while reading -``` -However, for your convienence, an unoffical and working version is provided -here: - -https://github.com/jlesage/docker-baseimage-gui/raw/master/tools/ssvnc_windows_only-1.0.30-r1.zip - -The only difference with the offical package is that the bundled version of -`stunnel` has been upgraded to version `5.49`, which fixes the connection -problems. - -### Certificates - -Here are the certificate files needed by the container. By default, when they -are missing, self-signed certificates are generated and used. All files have -PEM encoded, x509 certificates. - -| Container Path | Purpose | Content | -|---------------------------------|----------------------------|---------| -|`/config/certs/vnc-server.pem` |VNC connection encryption. |VNC server's private key and certificate, bundled with any root and intermediate certificates.| -|`/config/certs/web-privkey.pem` |HTTPs connection encryption.|Web server's private key.| -|`/config/certs/web-fullchain.pem`|HTTPs connection encryption.|Web server's certificate, bundled with any root and intermediate certificates.| - -**NOTE**: To prevent any certificate validity warnings/errors from the browser -or VNC client, make sure to supply your own valid certificates. - -**NOTE**: Certificate files are monitored and relevant daemons are automatically -restarted when changes are detected. - -### VNC Password - -To restrict access to your application, a password can be specified. This can -be done via two methods: - * By using the `VNC_PASSWORD` environment variable. - * By creating a `.vncpass_clear` file at the root of the `/config` volume. - This file should contains the password in clear-text. During the container - startup, content of the file is obfuscated and moved to `.vncpass`. - -The level of security provided by the VNC password depends on two things: - * The type of communication channel (encrypted/unencrypted). - * How secure access to the host is. - -When using a VNC password, it is highly desirable to enable the secure -connection to prevent sending the password in clear over an unencrypted channel. - -**ATTENTION**: Password is limited to 8 characters. This limitation comes from -the Remote Framebuffer Protocol [RFC](https://tools.ietf.org/html/rfc6143) (see -section [7.2.2](https://tools.ietf.org/html/rfc6143#section-7.2.2)). Any -characters beyhond the limit are ignored. - -## Reverse Proxy - -The following sections contains NGINX configuration that need to be added in -order to reverse proxy to this container. - -A reverse proxy server can route HTTP requests based on the hostname or the URL -path. - -### Routing Based on Hostname - -In this scenario, each hostname is routed to a different application/container. - -For example, let's say the reverse proxy server is running on the same machine -as this container. The server would proxy all HTTP requests sent to -`chromium.domain.tld` to the container at `127.0.0.1:5800`. - -Here are the relevant configuration elements that would be added to the NGINX -configuration: - -``` -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} - -upstream docker-chromium { - # If the reverse proxy server is not running on the same machine as the - # Docker container, use the IP of the Docker host here. - # Make sure to adjust the port according to how port 5800 of the - # container has been mapped on the host. - server 127.0.0.1:5800; -} - -server { - [...] - - server_name chromium.domain.tld; - - location / { - proxy_pass http://docker-chromium; - } - - location /websockify { - proxy_pass http://docker-chromium; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 86400; - } -} - -``` - -### Routing Based on URL Path - -In this scenario, the hostname is the same, but different URL paths are used to -route to different applications/containers. - -For example, let's say the reverse proxy server is running on the same machine -as this container. The server would proxy all HTTP requests for -`server.domain.tld/chromium` to the container at `127.0.0.1:5800`. - -Here are the relevant configuration elements that would be added to the NGINX -configuration: - -``` -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} - -upstream docker-chromium { - # If the reverse proxy server is not running on the same machine as the - # Docker container, use the IP of the Docker host here. - # Make sure to adjust the port according to how port 5800 of the - # container has been mapped on the host. - server 127.0.0.1:5800; -} - -server { - [...] - - location = /chromium {return 301 $scheme://$http_host/chromium/;} - location /chromium/ { - proxy_pass http://docker-chromium/; - location /chromium/websockify { - proxy_pass http://docker-chromium/websockify/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_read_timeout 86400; - } - } -} - -``` -## Shell Access - -To get shell access to a the running container, execute the following command: - -``` -docker exec -it CONTAINER sh -``` - -Where `CONTAINER` is the ID or the name of the container used during its -creation (e.g. `crashplan-pro`). - -## Increasing Shared Memory Size - -To prevent crashes from happening when running Chromium -inside a Docker container, the size of the shared memory located at `/dev/shm` -must be increased. The issue is documented [here]. - -By default, the size is 64MB, which is not enough. It is recommended to use a -size of 2GB. This value is arbitrary, but known to work well. Setting the -size of `/dev/shm` can be done via two method: - - - By adding the `--shm-size 2g` parameter to the `docker run` command. See - the [Usage](#usage) section for more details. - - By using shared memory of the host, by mapping `/dev/shm` via the parameter - `-v /dev/shm:/dev/shm` of the `docker run` command. - -## Sound Support - -For Chromium to be able to use the audio device available on -the host, `/dev/snd` must be exposed to the container by adding the -`--device /dev/snd` parameter to the `docker run` command. - -## Troubleshooting - -### Crashes - -If Chromium is crashing frequently, make sure the size of -the shared memory located at `/dev/shm` has been increased. See -[Increasing Shared Memory Size](#increasing-shared-memory-size) section for more -details. - -## Support or Contact - -Having troubles with the container or have questions? Please -[create a new issue]. - -For other great Dockerized applications, see https://jlesage.github.io/docker-apps. - -[create a new issue]: https://github.com/overclockedllama/docker-chromium/issues diff --git a/appdefs.xml b/appdefs.xml deleted file mode 100644 index 39c1678..0000000 --- a/appdefs.xml +++ /dev/null @@ -1,250 +0,0 @@ - - - - 14 - x11 - Firefox - {{ defs.app.friendly_name|lower|replace(' ', '-') }} - - Mozilla Firefox is a free and open-source web browser developed by Mozilla Foundation and its subsidiary, Mozilla Corporation. - https://www.mozilla.org/en-US/firefox/ - - - https://forums.unraid.net/topic/69440-support-firefox/ - Tools: - - - 150MB - /storage - - - -
- Increasing Shared Memory Size - -To prevent crashes from happening when running {{ defs.app.friendly_name }} -inside a Docker container, the size of the shared memory located at `/dev/shm` -must be increased. The issue is documented [here]. - -By default, the size is 64MB, which is not enough. It is recommended to use a -size of 2GB. This value is arbitrary, but known to work well. Setting the -size of `/dev/shm` can be done via two method: - - - By adding the `--shm-size 2g` parameter to the `docker run` command. See - the [Usage](#usage) section for more details. - - By using shared memory of the host, by mapping `/dev/shm` via the parameter - `-v /dev/shm:/dev/shm` of the `docker run` command. - -
-
- Sound Support - -For {{ defs.app.friendly_name }} to be able to use the audio device available on -the host, `/dev/snd` must be exposed to the container by adding the -`--device /dev/snd` parameter to the `docker run` command. - -
-
- Setting {{ defs.app.friendly_name }} Preferences Via Environment Variables - -{{ defs.app.friendly_name }} preferences can be set via environment variables -passed to the containter. During the startup, a script process all these -variables and modify the preference file accordingly. - -The name of the environment variable must start with `FF_PREF_`, followed by a -string of your choice. For example, `FF_PREF_MY_PREF` is a valid name. - -The content of the variable should be in the format `NAME=VAL`, where `NAME` is -the name of the preference (as found in the `about:config` page) and `VAL` is -its value. A value can be one of the following type: - - string - - integer - - boolean -It is important to note that a value of type `string` should be surrounded by -double quotes. Other types don't need them. - -For example, to set the `network.proxy.http` preference, one would pass the -environment variable to the container by adding the following argument to the -`docker run` command: - -``` --e "FF_PREF_HTTP_PROXY=network.proxy.http=\"proxy.example.com\"" -``` - -If a preference needs to be *removed*, its value should be set to `UNSET`. For -example: - -``` --e "FF_PREF_HTTP_PROXY=network.proxy.http=UNSET" -``` - -**NOTE**: This is an advanced usage and it is recommended to set preferences -via {{ defs.app.friendly_name }} directly. - -
-
- Troubleshooting - -
-
- Crashes - -If {{ defs.app.friendly_name }} is crashing frequently, make sure the size of -the shared memory located at `/dev/shm` has been increased. See -[Increasing Shared Memory Size](#increasing-shared-memory-size) section for more -details. - -
- - here - https://bugzilla.mozilla.org/show_bug.cgi?id=1338771#c10 - -
- - - - 1.11.0 - 2020-04-25 - Upgraded Firefox to version 75.0-r2. - - - 1.10.0 - 2020-03-15 - Upgraded Firefox to version 74.0-r0. - - - 1.9.1 - 2020-02-10 - Upgraded Firefox to version 72.0.2-r0. - - - 1.9.0 - 2020-01-14 - Upgraded Firefox to version 72.0.1-r0. - - - 1.8.0 - 2019-12-25 - Upgraded Firefox to version 71.0-r0. - Now using baseimage v3.5.3, which brings the following changes: - Updated installed packages to get latest security fixes. - Make sure the tzdata is installed. - Use baseimage based on Alpine Linux 3.10. - - - 1.7.1 - 2019-08-26 - Upgraded Firefox to version 68.0.2-r0. - - - 1.7.0 - 2019-08-05 - Upgraded Firefox to version 68.0.r0. - - - 1.6.0 - 2019-07-17 - Upgraded Firefox to version 67.0.4-r0. - - - 1.5.1 - 2019-05-12 - Upgraded Firefox to version 66.0.5-r1. - - - 1.5.0 - 2019-05-09 - Upgraded Firefox to version 66.0.4-r0. - Print the Firefox version during the container startup. - - - 1.4.1 - 2019-04-24 - Upgraded Firefox to version 62.0.3-r4. - Now using baseimage v3.5.2, which brings the following changes: - Updated installed packages to get latest security fixes. - Fixed issue where the container could have a zombie process. - Fixed issue where the password would not be submitted when pressing the enter key in the password modal. - Use relative path for favicon ressources to be more friendly with reverse proxy senarios. - - - 1.4.0 - 2019-02-24 - Upgraded Firefox to version 62.0.3-r2. - Preferences can now be set via environment variables. - Use baseimage based on Alpine Linux 3.9. - - - 1.3.1 - 2018-09-18 - Now using baseimage v3.5.1, which brings the following changes: - Updated installed packages to get latest security fixes. - - - 1.3.0 - 2018-07-27 - Added support for more playable video formats. - Added support for sound in Firefox. - - - 1.2.0 - 2018-07-12 - Now using baseimage v3.4.0, which is based on Alpine Linux 3.8. - Upgraded Firefox to version 61.0.1-r0. - - - 1.1.0 - 2018-05-31 - Upgraded Firefox to version 60.0.1-r0. - - - 1.0.2 - 2018-03-15 - Fixed issue where Firefox would not gracefully terminate. - Fixed an issue where restoring session would resize window to the wrong dimensions. - - - 1.0.1 - 2018-03-02 - Now using baseimage v3.3.4, which brings the following changes: - Fixed issue where log monitor states were not cleared during container startup. - Updated Firefox to version 58.0.1-r2. - - - 1.0.0 - 2018-02-16 - Initial release. - - -
- - - - - - - - - - - /dev/snd - Optional Linux device to expose to have sound. - false - - - - - - shm-size - 2g - Set the size of `/dev/shm` to `VALUE`. The format of `VALUE` is `<number><unit>`, where `number` must be greater than `0` and `unit` can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). **NOTE**: To avoid crashes, it is recommended to set this value to `2g`. - true - - - -
diff --git a/deploy/k8s/statefulset-chromium.yaml b/deploy/k8s/statefulset-chromium.yaml new file mode 100644 index 0000000..1fec0d1 --- /dev/null +++ b/deploy/k8s/statefulset-chromium.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: chromium + name: chromium + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: chromium + serviceName: chromium + template: + metadata: + labels: + app: chromium + spec: + containers: + - env: + - name: TZ + value: "Etc/UTC" + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: ghcr.io/putty182/docker-chromium + imagePullPolicy: Always + name: chromium + ports: + - containerPort: 3000 + name: guac-tcp + protocol: TCP + resources: + limits: + cpu: "4" + memory: 8G + requests: + cpu: 100m + memory: 450M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /config + name: chromium-config + - mountPath: /dev/shm + name: shared-memory + - mountPath: /downloads + name: chromium-downloads + volumes: + - name: chromium-config + persistentVolumeClaim: + claimName: chromium-config + - name: chromium-downloads + persistentVolumeClaim: + claimName: chromium-downloads + - emptyDir: + medium: Memory + sizeLimit: 4G + name: shared-memory diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index ae8a282..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '3' -services: - chrome: - image: overclockedllama/docker-chromium - ports: - - "5800:5800" - # - "5900:5900" - volumes: - - "./config:/config:rw" - environment: - - VNC_PASSWORD=badpassword - shm_size: '2gb' - restart: always diff --git a/root/defaults/autostart b/root/defaults/autostart new file mode 100644 index 0000000..34b4a4d --- /dev/null +++ b/root/defaults/autostart @@ -0,0 +1 @@ +chromium-browser --no-sandbox --user-data-dir=/config/profile diff --git a/root/defaults/menu.xml b/root/defaults/menu.xml new file mode 100644 index 0000000..2403b0a --- /dev/null +++ b/root/defaults/menu.xml @@ -0,0 +1,29 @@ + + + + + + + xterm + + + + + + + chromium-browser --no-sandbox --user-data-dir=/config/profile + + yes + Chromium + + + + + + + + + + + + diff --git a/root/etc/cont-init.d/60-menu-config b/root/etc/cont-init.d/60-menu-config new file mode 100644 index 0000000..0813912 --- /dev/null +++ b/root/etc/cont-init.d/60-menu-config @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +# default file copies first run +[[ ! -d /config/.config/openbox/menu.xml ]] && \ + mkdir -p /config/.config/openbox && \ + cp /defaults/menu.xml /config/.config/openbox/menu.xml && \ + chown -R abc:abc /config/.config/openbox diff --git a/rootfs/etc/cont-init.d/check-snd.sh b/rootfs/etc/cont-init.d/check-snd.sh deleted file mode 100755 index dcbdfb1..0000000 --- a/rootfs/etc/cont-init.d/check-snd.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/with-contenv sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -log() { - echo "[cont-init.d] $(basename $0): $*" -} - -SND_DEV="/dev/snd" - -if [ ! -d "$SND_DEV" ]; then - log "sound not supported: device $SND_DEV not exposed to the container." - exit 0 -fi - -# Save the associated group. -SND_GRP="$(find "$SND_DEV" -maxdepth 1 -not -type d -exec stat -c "%g" {} \; | sort -u | tail -n1)" -log "sound device group $SND_GRP." -if [ -f /var/run/s6/container_environment/SUP_GROUP_IDS ]; then - echo -n "," >> /var/run/s6/container_environment/SUP_GROUP_IDS -fi -echo -n "$SND_GRP" >> /var/run/s6/container_environment/SUP_GROUP_IDS - -# vim: set ft=sh : diff --git a/rootfs/etc/cont-init.d/firefox-set-prefs-from-env.sh b/rootfs/etc/cont-init.d/firefox-set-prefs-from-env.sh deleted file mode 100755 index 2898de2..0000000 --- a/rootfs/etc/cont-init.d/firefox-set-prefs-from-env.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/with-contenv sh - -set -e - -log() { - echo "[cont-init.d] $(basename $0): $*" -} - -PREF_FILE="${1:-/config/profile/prefs.js}" - -if [ -z "$PREF_FILE" ]; then - log "ERROR: Preference file not set." - exit 1 -fi - -mkdir -p "$(dirname "$PREF_FILE")" -[ -f "$PREF_FILE" ] || touch "$PREF_FILE" - -env | grep "^FF_PREF_" | while read ENV -do - ENAME="$(echo "$ENV" | cut -d '=' -f1)" - EVAL="$(echo "$ENV" | cut -d '=' -f2-)" - - if [ -z "$EVAL" ]; then - log "Skipping environment variable '$ENAME': no value set." - continue - fi - - if echo "$EVAL" | grep -q "="; then - PNAME="$(echo "$EVAL" | cut -d '=' -f1)" - PVAL="$(echo "$EVAL" | cut -d '=' -f2-)" - [ -n "$PVAL" ] || PVAL='""' - else - PNAME="$EVAL" - PVAL='""' - fi - - if [ "$PVAL" = "UNSET" ]; then - log "Removing preference '$PNAME'..." - sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE" - elif grep -q "user_pref(\"$PNAME\"," "$PREF_FILE"; then - log "Setting preference '$PNAME'..." - sed -i "s/user_pref(\"$PNAME\",.*);/user_pref(\"$PNAME\", $PVAL);/" "$PREF_FILE" - else - log "Setting new preference '$PNAME'..." - echo "user_pref(\"$PNAME\", $PVAL);" >> "$PREF_FILE" - fi -done diff --git a/rootfs/etc/cont-init.d/firefox.sh b/rootfs/etc/cont-init.d/firefox.sh deleted file mode 100755 index cc7230c..0000000 --- a/rootfs/etc/cont-init.d/firefox.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/with-contenv sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -log() { - echo "[cont-init.d] $(basename $0): $*" -} - -# Make sure some directories are created. -mkdir -p /config/downloads -mkdir -p /config/log/chromium - -# Generate machine id. -if [ ! -f /etc/machine-id ]; then - log "generating machine-id..." - cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id -fi - -# Verify the size of /dev/shm. -SHM_SIZE_MB="$(df -m /dev/shm | tail -n 1 | tr -s ' ' | cut -d ' ' -f2)" -if [ "$SHM_SIZE_MB" -eq 64 ]; then - echo 'FAIL' > /tmp/.chromium_shm_check -else - echo 'PASS' > /tmp/.chromium_shm_check -fi - -# Clean/optimize Firefox databases. -#if [ -d /config/.mozilla/firefox ] && [ -d /config/profile ]; then -# [ -f /config/.mozilla/firefox/profiles.ini ] || cp /defaults/profiles.ini /config/.mozilla/firefox/ -# env HOME=/config /usr/bin/profile-cleaner f -#fi - -# Fix window display size is session stores. -if [ -n "$(ls /config/profile/sessionstore-backups/*.jsonlz4 2>/dev/null)" ]; then - for FILE in /config/profile/sessionstore-backups/*.jsonlz4; do - WORKDIR="$(mktemp -d)" - - dejsonlz4 "$FILE" "$WORKDIR"/json - cp "$WORKDIR"/json "$WORKDIR"/json.orig - - sed -i 's/"width":[0-9]\+/"width":'$DISPLAY_WIDTH'/' "$WORKDIR"/json - sed -i 's/"height":[0-9]\+/"height":'$DISPLAY_HEIGHT'/' "$WORKDIR"/json - sed -i 's/"screenX":[0-9]\+/"screenX":0/' "$WORKDIR"/json - sed -i 's/"screenY":[0-9]\+/"screenY":0/' "$WORKDIR"/json - - if ! diff "$WORKDIR"/json "$WORKDIR"/json.orig >/dev/null; then - jsonlz4 "$WORKDIR"/json "$WORKDIR"/jsonlz4 - mv "$WORKDIR"/jsonlz4 "$FILE" - log "fixed display size in $FILE." - fi - - rm -r "$WORKDIR" - done -fi - -# Make sure monitored log files exist. -for LOG_FILE in /config/log/chromium/error.log -do - touch "$LOG_FILE" -done - -# Take ownership of the config directory content. -find /config -mindepth 1 -exec chown $USER_ID:$GROUP_ID {} \; - -# vim: set ft=sh : diff --git a/rootfs/etc/logmonitor/notifications.d/shm_size/desc b/rootfs/etc/logmonitor/notifications.d/shm_size/desc deleted file mode 100755 index aff42c9..0000000 --- a/rootfs/etc/logmonitor/notifications.d/shm_size/desc +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/with-contenv sh -echo "$APP_NAME is likely to crash because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation to find out how this can be done." diff --git a/rootfs/etc/logmonitor/notifications.d/shm_size/filter b/rootfs/etc/logmonitor/notifications.d/shm_size/filter deleted file mode 100755 index 8b78571..0000000 --- a/rootfs/etc/logmonitor/notifications.d/shm_size/filter +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -LINE="$1" - -if [ "$LINE" = "FAIL" ]; then - echo 'ACK' > /tmp/.firefox_shm_check - exit 0 -fi - -# No match found. -exit 1 - -# vim: set ft=sh : diff --git a/rootfs/etc/logmonitor/notifications.d/shm_size/level b/rootfs/etc/logmonitor/notifications.d/shm_size/level deleted file mode 100644 index e2500fa..0000000 --- a/rootfs/etc/logmonitor/notifications.d/shm_size/level +++ /dev/null @@ -1 +0,0 @@ -WARNING diff --git a/rootfs/etc/logmonitor/notifications.d/shm_size/title b/rootfs/etc/logmonitor/notifications.d/shm_size/title deleted file mode 100755 index 3d5d615..0000000 --- a/rootfs/etc/logmonitor/notifications.d/shm_size/title +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/with-contenv sh -echo "$APP_NAME lacks of shared memory." diff --git a/rootfs/etc/logmonitor/notifications.d/tab_crash/desc b/rootfs/etc/logmonitor/notifications.d/tab_crash/desc deleted file mode 100755 index 339f8de..0000000 --- a/rootfs/etc/logmonitor/notifications.d/tab_crash/desc +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/with-contenv sh -echo "A $APP_NAME tab crashed because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation to find out how this can be done." diff --git a/rootfs/etc/logmonitor/notifications.d/tab_crash/filter b/rootfs/etc/logmonitor/notifications.d/tab_crash/filter deleted file mode 100755 index 21e16b4..0000000 --- a/rootfs/etc/logmonitor/notifications.d/tab_crash/filter +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -LINE="$1" - -#if echo "$LINE" | grep -q "OutOfMemoryError occurred...RESTARTING!"; then -if [ "$LINE" = "###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv" ] -then - exit 0 -fi - -# No match found. -exit 1 - -# vim: set ft=sh : diff --git a/rootfs/etc/logmonitor/notifications.d/tab_crash/level b/rootfs/etc/logmonitor/notifications.d/tab_crash/level deleted file mode 100644 index 5df7507..0000000 --- a/rootfs/etc/logmonitor/notifications.d/tab_crash/level +++ /dev/null @@ -1 +0,0 @@ -ERROR diff --git a/rootfs/etc/logmonitor/notifications.d/tab_crash/title b/rootfs/etc/logmonitor/notifications.d/tab_crash/title deleted file mode 100755 index 3d5d615..0000000 --- a/rootfs/etc/logmonitor/notifications.d/tab_crash/title +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/with-contenv sh -echo "$APP_NAME lacks of shared memory." diff --git a/rootfs/startapp.sh b/rootfs/startapp.sh deleted file mode 100755 index f11e229..0000000 --- a/rootfs/startapp.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/with-contenv sh - -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error. - -export HOME=/config -mkdir -p /config/profile -whoami -exec /usr/bin/firefox_wrapper --no-sandbox --user-data-dir=/config/profile >> /config/log/chromium/output.log 2>> /config/log/chromium/error.log diff --git a/rootfs/usr/bin/firefox_wrapper b/rootfs/usr/bin/firefox_wrapper deleted file mode 100755 index 162f19c..0000000 --- a/rootfs/usr/bin/firefox_wrapper +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -# -# This small wrapper is used to gracefully terminate Firefox. It prevents -# the application to receive termination signals directly. Instead, the wrapper -# traps signals and send CTRL+q key presses to Firefox. -# - -FF_PID=0 - -# Gracefully terminate Firefox. This function is called when this script -# receives a termination signal (SIGKILL, SIGINT or SIGQUIT). -kill_firefox() { - # Gracefully close Firefox. - echo "Terminating Firefox..." - xdotool key "Escape" - xdotool key "ctrl+q" - - # And wait for its termination. - if [ "$FF_PID" -ne 0 ]; then - wait $FF_PID - exit $? - fi -} -trap 'kill_firefox' TERM INT QUIT - -# This function is called when this script exits. It makes sure that Firefox is -# fully closed by waiting for all its processes to terminate. -exit_wrapper() { - echo "Waiting for Firefox to completely terminate..." - TIMEOUT=10 - while firefox_running && [ "$TIMEOUT" -gt 0 ]; do - TIMEOUT="$(expr "$TIMEOUT" - 1)" - sleep 1 - done - - if [ "$TIMEOUT" -gt 0 ]; then - echo "Firefox terminated." - else - echo "WARNING: Firefox still not terminated." - fi -} -trap 'exit_wrapper' EXIT - -firefox_running() { - ps | grep -v grep | grep -q '/usr/lib/chromium-browser' -} - -# Make sure to terminate any existing instance. -if firefox_running; then - kill_firefox -fi - -# Start Firefox in background. -/usr/bin/chromium-browser "$@" & - -# And wait for its termination. -FF_PID=$! -wait $FF_PID -exit $?