diff --git a/.github/workflows/deploy-readme.sh b/.github/workflows/deploy-readme.sh new file mode 100644 index 0000000..11961e4 --- /dev/null +++ b/.github/workflows/deploy-readme.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +main() { + local repo="${1?Need repo}" + local gist="${2?Need gist}" + local readme_context="${3?Need build context}" + local readme_main="${4?Need readme main part}" + local readme_append=${5?Need readme append template} + + local api_base_url="https://hub.docker.com/v2" + local deployment_repo + local readme_main_file="${PWD}/${readme_context}/${readme_main}" + local readme_append_file="${PWD}/${readme_context}/${readme_append}" + local scrap_append_file="${PWD}/${readme_context}/scrap-append.tmp" + local readme_upload_file="${PWD}/${readme_context}/scrap-readme.md" + local repo_name + local repo_owner + local response + local user_name="${DOCKERHUB_USERNAME}" + local user_pwd="${DOCKERHUB_PASSWORD}" + local token + + if [ ! -f "${readme_main_file}" ] ; then + echo "File not found: '${readme_main_file}'" + return 1 + fi + if [ ! -f "${readme_append_file}" ] ; then + echo "File not found: '${readme_append_file}'" + return 1 + fi + + ### extract the repo owner and its name + ### alternative 1 + repo_name="$(basename $repo)" + repo_owner="$(basename $(dirname ${repo}))" + ### alternative 2 + # repo_name="${repo##*/}" + # repo_owner="${repo%$repo_name}" ; repo_owner="${repo_owner::-1}" ; repo_owner="${repo_owner##*/}" + ### also ensure that the deployment repo has only two parts like 'repo_owner/repo_name' + # deployment_repo="$(basename $(dirname ${repo}))/$(basename ${repo})" + deployment_repo="${repo_owner}/${repo_name}" + + ### create the actual README file for Docker Hub by replacing the variables in the append-template (badge links) + ### and appending it to the main-readme partial file + ### it is expected that the readme include template contains the following variables: + ### ${OWNER} - owner of the deployment repository and also the related deployment gist + ### ${GIST} - gist containing the badge endpoints + ### ${REPO} - name of the deployment repository + + ### replace the environment variables in the template + $( OWNER="${repo_owner}" GIST="${gist}" REPO="${repo_name}" envsubst < "${readme_append_file}" > "${scrap_append_file}" ) + + ### append the updated template to the main readme part + cat "${readme_main_file}" "${scrap_append_file}" > "${readme_upload_file}" + + # get token to be able to talk to Docker Hub + echo "GET token" + token=$( curl -s \ + -X POST \ + "${api_base_url}/users/login/" \ + -H "Content-Type: application/json" \ + -d '{"username": "'${user_name}'", "password": "'${user_pwd}'"}' | sed -e 's/.*"token": "\(.*\)".*/\1/' ) + + echo "UPDATE Docker Hub using template '${readme_template_name}'" + response=$( curl -s \ + -X PATCH \ + "${api_base_url}/repositories/${deployment_repo}/" \ + -H "Authorization: JWT ${token}" \ + --write-out %{response_code} \ + --output /dev/null \ + --data-urlencode "full_description@${readme_upload_file}" ) + + if [ ${response} -eq 200 ] ; then + echo "${response}. UPDATE success." + return 0 + else + echo "ERROR: ${response}. Unable to UPDATE Docker Hub description." + echo user_name="${user_name}" + echo deployment_repo="${deployment_repo}" + echo readme_upload_file=${readme_upload_file} + echo api_base_url=${api_base_url} + echo "curl -H "Authorization: JWT ${token}" -X PATCH --data-urlencode full_description@${readme_upload_file} ${api_base_url}/repositories/${deployment_repo}/" + curl -v -H "Authorization: JWT ${token}" -X PATCH --data-urlencode full_description@${readme_upload_file} ${api_base_url}/repositories/${deployment_repo}/ + return 1 + fi +} + +main $@ diff --git a/.github/workflows/dockerhub-autobuild.yml b/.github/workflows/dockerhub-autobuild.yml new file mode 100644 index 0000000..4690d7d --- /dev/null +++ b/.github/workflows/dockerhub-autobuild.yml @@ -0,0 +1,44 @@ +### This workflow triggers auto-building on Docker Hub. +name: dockerhub-autobuild +on: + release: + ### published: a release, pre-release, or draft of a release is published + ### unpublished: a release or pre-release is deleted + ### created: a draft is saved, or a release or pre-release is published without previously being saved as a draft + ### edited: a release, pre-release, or draft release is edited + ### deleted: a release, pre-release, or draft release is deleted + ### prereleased: a pre-release is created + ### released: a release or draft of a release is published, or a pre-release is changed to a release + types: [published] + schedule: + ### * is a special character in YAML so you have to quote this string + ### every 5 minutes (for testing only) + # - cron: '*/5 * * * *' + ### at 03:15 on every Sunday + - cron: '15 3 * * 0' +jobs: + call-dockerhub: + runs-on: ubuntu-latest + steps: + - name: Report trigger + ### "tag_name": "v1.0.0", + ### "target_commitish": "master", + ### "name": "v1.0.0", + ### "body": "Description of the release", + ### "draft": false, + ### "prerelease": false, + ### "created_at": "2013-02-27T19:35:32Z", + ### "published_at": "2013-02-27T19:35:32Z", + shell: bash + run: | + echo "Event name: ${{ github.event_name }}" + echo "Release branch: ${{ github.event.release.target_commitish }}" + echo "Release tag: ${{ github.event.release.tag_name }}" + echo "Is draft: ${{ github.event.release.draft }}" + echo "Is prerelease: ${{ github.event.release.prerelease }}" + echo "Created at: ${{ github.event.release.created_at }}" + - name: Call webhook + shell: bash + run: | + echo "Call webhook" + curl -X POST -s -o /dev/null --write-out "%{http_code}" ${{ secrets.DockerHubWebhookBuildRelease }} diff --git a/.github/workflows/dockerhub-post-push.yml b/.github/workflows/dockerhub-post-push.yml new file mode 100644 index 0000000..fb81a95 --- /dev/null +++ b/.github/workflows/dockerhub-post-push.yml @@ -0,0 +1,59 @@ +### This workflow can be optionally triggered by Docker Hub after pushing an image. +name: dockerhub-post-push +on: + workflow_dispatch: + inputs: + repo: + required: true + default: '(repo not provided)' + tag: + required: true + default: '(tag not provided)' + gist: + required: true + default: '(gist not provided)' + readme_context: + required: true + default: '(readme context not provided)' + created: + required: true + default: '(created not provided)' + version_sticker: + required: true + default: '(version_sticker not provided)' + version_sticker_verbose: + required: true + default: '(version_sticker_verbose not provided)' +jobs: + dockerhub-callback: + runs-on: ubuntu-latest + steps: + - name: Report trigger + shell: bash + run: | + echo "Event: ${{ github.event_name }}" + echo "Repo: ${{ github.event.inputs.repo }}" + echo "Tag: ${{ github.event.inputs.tag }}" + echo "Gist: ${{ github.event.inputs.gist }}" + echo "Readme context: ${{ github.event.inputs.readme_context }}" + echo "Created at: ${{ github.event.inputs.created }}" + echo "Version sticker: ${{ github.event.inputs.version_sticker }}" + echo -e "Version sticker verbose:\n${{ github.event.inputs.version_sticker_verbose }}" + dockerhub-description: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Publish Docker Hub description + shell: bash + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + run: | + chmod +x .github/workflows/deploy-readme.sh + sleep 60 + .github/workflows/deploy-readme.sh \ + "${{ github.event.inputs.repo }}" \ + "${{ github.event.inputs.gist }}" \ + "${{ github.event.inputs.readme_context }}" \ + "README-dockerhub.md" \ + "readme-append.template" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..04b5379 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# CHANGELOG + +## Project `accetto/ubuntu-vnc-xfce-g3` + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Wiki][this-wiki] + +*** + +### Release 20.12 + +- Initial release + - **xfce** into [accetto/ubuntu-vnc-xfce-g3][accetto-ubuntu-vnc-xfce-g3] + - **xfce-chromium** into [accetto/ubuntu-vnc-xfce-chromium-g3][accetto-ubuntu-vnc-xfce-chromium-g3] + - **xfce-firefox** into [accetto/ubuntu-vnc-xfce-firefox-g3][accetto-ubuntu-vnc-xfce-firefox-g3] + +*** + +[this-docker]: https://hub.docker.com/u/accetto/ + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki + +[accetto-ubuntu-vnc-xfce-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-g3 +[accetto-ubuntu-vnc-xfce-chromium-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-chromium-g3 +[accetto-ubuntu-vnc-xfce-firefox-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-firefox-g3 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..80d1f1f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 accetto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d2c3ff --- /dev/null +++ b/README.md @@ -0,0 +1,158 @@ +# Headless Ubuntu/Xfce containers with VNC/noVNC + +## Project `accetto/ubuntu-vnc-xfce-g3` + +*** + +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] +![badge-github-stars][badge-github-stars] +![badge-github-forks][badge-github-forks] +![badge-github-open-issues][badge-github-open-issues] +![badge-github-closed-issues][badge-github-closed-issues] +![badge-github-releases][badge-github-releases] +![badge-github-commits][badge-github-commits] +![badge-github-last-commit][badge-github-last-commit] + +![badge-github-workflow-dockerhub-autobuild][badge-github-workflow-dockerhub-autobuild] +![badge-github-workflow-dockerhub-post-push][badge-github-workflow-dockerhub-post-push] + +*** + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment and [VNC][tigervnc]/[noVNC][novnc] servers for headless use. + +The resources for the individual images and their variations (tags) are stored in the subfolders of the **master** branch. Each image has its own README file describing its features and usage. + +### Image generations + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) contains the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) contains the GitHub repositories [accetto/ubuntu-vnc-xfce][accetto-docker-ubuntu-vnc-xfce], [accetto/ubuntu-vnc-xfce-firefox][accetto-docker-ubuntu-vnc-xfce-firefox], [accetto/ubuntu-vnc-xfce-firefox-plus][accetto-docker-ubuntu-vnc-xfce-firefox-plus] and [accetto/ubuntu-vnc-xfce-chromium][accetto-docker-ubuntu-vnc-xfce-chromium]. + +### Project goals + +Unlike the first two generations, this one aims to support CI. One of the main project goals has been to implement a simple and cheap *self-containing* CI with minimal dependencies outside the project itself. There are only three service providers used, all available for free: + +- [**GitHub**][github] hosts everything required for building the Docker images. Both public and private repositories can be used. **GitHub Gists** are used for persisting data, e.g. badge endpoints. **GitHub Actions** are also used. + +- [**Docker Hub**][dockerhub] hosts the Docker images and is also used for building them. Public or private repositories can be used. + +- [**Badgen.net**][badgen] is used for generating and hosting most of the badges. + +None of the above service providers is really required. Images can be built locally under Linux or Windows and published elsewhere. + +Building process is implemented to minimize image pollution. New images are pushed to the repositories only if something essential has changed. This could be overridden if needed. + +### Changes and new features + +#### Naming scheme + +Unlike the first two generations, this one will aim to use less Docker Hub **image repositories** with more **image tags**. For example, previously there have been two Docker Hub repositories `xubuntu-vnc` and `ubuntu-vnc-novnc`. Now there will be only one Docker Hub repository `accetto/ubuntu-vnc-xfce-g3` containing tags `vnc` and `vnc-novnc`. + +#### Slimmer images + +New images are significantly slimmer than the previous ones. It's because that the most of the packages are installed with the `apt-get` switch `--no-install-recommends` by default. This could have consequences, so it is configurable. + +#### Fewer and more flexible Dockerfiles + +Image variations are build from fewer Dockerfiles. This is allowed by using *multi-stage builds* and *Buildkit*. On the other hand, flexible and configurable Dockerfiles are slightly more complex. + +#### Concept of features + +Flexibility in Dockerfiles is supported by introducing the concept of **features**. These are variables that control the building process. For example, the variable **FEATURES_BUILD_SLIM** controls the `--no-install-recommends` switch, the variable **FEATURES_NOVNC** controls the inclusion of *noVNC* and so on. Some other available features include, for example, the **FEATURES_SCREENSHOOTING**, **FEATURES_THUMBNAILING** and **FEATURES_USER_GROUP_OVERRIDE** variables. + +#### Optional overriding of user group by `docker run` + +Support for overriding the user group by `docker run` has been introduced in the second generation. Please check its documentation for more information. This feature is now controlled by the variable **FEATURES_USER_GROUP_OVERRIDE**. + +#### Different use of version sticker + +The concept of version sticker has been introduced in the second generation and later implemented also in the first generation. Check this [Wiki page](https://github.com/accetto/xubuntu-vnc/wiki/Version-sticker) for more information. However, the usage of the version sticker has been changed in the third generation. Previously it has been used for testing, if there are some newer packages available by following the *try-and-fail* pattern. That was sufficient for human controlled building process, but it became a problem for CI. Therefore it is used differently now. The verbose version sticker is used for minimizing image pollution. The short form of the version sticker is available as an image *label* and a *badge* in the README file. The version sticker badge is also linked with the verbose version sticker *gist*, so it is possible to check the actual image configuration even without downloading it. + +#### Image metadata + +The image metadata are now stored exclusively as image *labels*. The previous environment variables like **REFRESHED_AT** or **VERSION_STICKER** have been removed. Most of the labels are namespaced according the [OCI IMAGE SPEC](https://github.com/opencontainers/image-spec) recommendations. However, the `version-sticker` label is in the namespace `any.accetto` for obvious reasons. + +#### Simple self-containing CI + +The third generation implements a relatively simple self-containing CI by utilizing the Docker Hub builder *hooks*. The same build pipeline can be executed also manually if building locally. For example, an image can be refreshed by executing the `/hooks/pre_build` and `/hooks/build` scripts. The script `/hooks/push` will push the image to the deployment repository. The script `/hooks/post_push` will update the *gist* data and trigger the **GitHub Actions** workflow, which will publish the image's README file to Docker Hub. + +#### Separated builder and deployment repositories + +While there is only one GitHub repository, containing the resource for building all images, there are two kinds of repositories on Docker Hub. A single *builder repository* is used for building all images. The final images are then published into one or more *deployment repositories*. This separation allows to keep permutations by naming reasonable. Not all repositories must have the same visibility, they can be private or public as required. The same repository could be also used for building and deployment. + +#### Separate README files for Docker Hub + +Each deployment repository has its own README file for Docker Hub, which is published by CI workflows after the image has been pushed. The file is split into parts. The part containing the badge links is separated into a template file. The final README file is then generated by the script just before publishing. Re-publishing can be forced even if the image has not been actually refreshed. These README files are shorter, because their length is limited by Docker Hub. Therefore there are also full-length README files published only on GitHub. + +#### Based on Ubuntu 20.04 LTS + +The current images are based on the official [Ubuntu 20.04 LTS][docker-ubuntu] image. + +#### Using TigerVNC 1.11 + +The images use the latest [TigerVNC 1.11.0][tigervnc] server, which has introduced some significant changes in its startup process. Actually the images implement the newer TigerVNC nightly builds, that fix or mitigate some of the issues. + +#### New startup script + +The startup script has been completely redesigned with the help of [argbash][argbash-doc] tool and the image [accetto/argbash-docker][accetto-docker-argbash-docker]. Several new startup switches has been added. For example, there are startup switches `--wait`, `--skip-startup`, `--tail-null`, `--tail-vnc`, `--version-sticker` and `--version-sticker-verbose`. There are also startup modifiers `--skip-vnc`, `--skip-novnc`, `--debug` and `--verbose`. Also the utility switches `--help-usage`, `--help` and `--version` are available. + +*** + +## Issues + +If you have found a problem or you just have a question, please check the [Issues][this-issues] and the [Wiki][this-wiki] first. Please do not overlook the closed issues. + +If you do not find a solution, you can file a new issue. The better you describe the problem, the bigger the chance it'll be solved soon. + +## Credits + +Credit goes to all the countless people and companies, who contribute to open source community and make so many dreamy things real. + +*** + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-docker-ubuntu-vnc-xfce]: https://github.com/accetto/ubuntu-vnc-xfce +[accetto-docker-ubuntu-vnc-xfce-firefox]: https://github.com/accetto/ubuntu-vnc-xfce-firefox +[accetto-docker-ubuntu-vnc-xfce-firefox-plus]: https://github.com/accetto/ubuntu-vnc-xfce-firefox-plus +[accetto-docker-ubuntu-vnc-xfce-chromium]: https://github.com/accetto/ubuntu-vnc-xfce-chromium +[accetto-docker-argbash-docker]: https://hub.docker.com/r/accetto/argbash-docker + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[argbash-doc]: https://argbash.readthedocs.io/en/stable/index.html +[badgen]: https://badgen.net/ +[dockerhub]: https://hub.docker.com/ +[github]: https://github.com/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[xfce]: http://www.xfce.org + + + +[badge-github-workflow-dockerhub-autobuild]: https://github.com/accetto/ubuntu-vnc-xfce-g3/workflows/dockerhub-autobuild/badge.svg + +[badge-github-workflow-dockerhub-post-push]: https://github.com/accetto/ubuntu-vnc-xfce-g3/workflows/dockerhub-post-push/badge.svg + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + +[badge-github-stars]: https://badgen.net/github/stars/accetto/ubuntu-vnc-xfce-g3?icon=github&label=stars + +[badge-github-forks]: https://badgen.net/github/forks/accetto/ubuntu-vnc-xfce-g3?icon=github&label=forks + +[badge-github-releases]: https://badgen.net/github/releases/accetto/ubuntu-vnc-xfce-g3?icon=github&label=releases + +[badge-github-commits]: https://badgen.net/github/commits/accetto/ubuntu-vnc-xfce-g3?icon=github&label=commits + +[badge-github-last-commit]: https://badgen.net/github/last-commit/accetto/ubuntu-vnc-xfce-g3?icon=github&label=last%20commit + +[badge-github-closed-issues]: https://badgen.net/github/closed-issues/accetto/ubuntu-vnc-xfce-g3?icon=github&label=closed%20issues + +[badge-github-open-issues]: https://badgen.net/github/open-issues/accetto/ubuntu-vnc-xfce-g3?icon=github&label=open%20issues + + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..db5e977 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,4 @@ +# This is just a placeholder. The actual Dockerfile will be set by the hook scripts. +# Having this file allows to keep the default 'Dockerfile' value in the build rules on Docker Hub. + +FROM scratch diff --git a/docker/Dockerfile.xfce b/docker/Dockerfile.xfce new file mode 100644 index 0000000..02b6995 --- /dev/null +++ b/docker/Dockerfile.xfce @@ -0,0 +1,275 @@ +# syntax=docker/dockerfile:experimental + +ARG BASEIMAGE=ubuntu +ARG BASETAG=20.04 + +ARG ARG_FINAL_STAGE_BASE=stage_vnc + + +############### +### stage_cache +############### + +FROM ${BASEIMAGE}:${BASETAG} as stage_cache + +RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache +RUN apt-get update + # --mount=type=cache,target=/var/cache/apt \ + # --mount=type=cache,target=/var/lib/apt \ + + +#################### +### stage_essentials +#################### + +FROM ${BASEIMAGE}:${BASETAG} as stage_essentials + +SHELL ["/bin/bash", "-c"] + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y \ + jq \ + nano \ + psmisc \ + sudo \ + tini \ + wget + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # curl \ + # gdebi-core \ + # git \ + # inetutils-ping \ + # lsb-release \ + # net-tools \ + # unzip \ + # vim \ + # zip \ + + +################# +### stage_xserver +################# + +FROM stage_essentials as stage_xserver +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XSERVER=${ARG_APT_NO_RECOMMENDS:+1} + +ENV \ + NO_AT_BRIDGE=1 +# LANG='en_US.UTF-8' \ +# LANGUAGE='en_US:en' \ +# LC_ALL='en_US.UTF-8' + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + dbus-x11 \ + xauth \ + xinit \ + x11-xserver-utils \ + xdg-utils + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # x11-utils \ # adds 200MB + + +############## +### stage_xfce +############## + +FROM stage_xserver as stage_xfce +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XFCE=${ARG_APT_NO_RECOMMENDS:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + xfce4 \ + xfce4-terminal + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # && apt-get purge -y \ + # pm-utils \ + # xscreensaver* \ + + +############### +### stage_tools +############### + +FROM stage_xfce as stage_tools +ARG ARG_APT_NO_RECOMMENDS +ARG ARG_FEATURES_SCREENSHOOTING +ARG ARG_FEATURES_THUMBNAILING + +ENV \ + FEATURES_BUILD_SLIM_TOOLS=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_SCREENSHOOTING=${ARG_FEATURES_SCREENSHOOTING:+1} \ + FEATURES_THUMBNAILING=${ARG_FEATURES_THUMBNAILING:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + mousepad \ + ${ARG_FEATURES_SCREENSHOOTING:+ristretto xfce4-screenshooter} \ + ${ARG_FEATURES_THUMBNAILING:+tumbler} + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # ristretto \ + # xfce4-screenshooter \ + # tumbler \ + + +############# +### stage_vnc +############# + +FROM stage_tools as stage_vnc + +ENV \ + FEATURES_VNC=1 + +### 2020-10-03: nightly builds fix some TigerVNC issues (e.g #1097) +# RUN wget -qO- https://dl.bintray.com/tigervnc/stable/tigervnc-1.11.0.x86_64.tar.gz | tar xz --strip 1 -C / \ +RUN \ + wget -qO- http://tigervnc.bphinz.com/nightly/xc/x86_64/tigervnc-1.11.80-20201209gita3d7d7d4.x86_64.tar.gz | tar xz --strip 1 -C / \ + && ln -s /usr/libexec/vncserver /usr/bin/vncserver \ + && sed -i 's/exec(@cmd);/print "@cmd";\nexec(@cmd);/g' /usr/libexec/vncserver + + +############### +### stage_novnc +############### + +FROM stage_vnc as stage_novnc +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_NOVNC=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_NOVNC=1 + +### using the same parent path as TigerVNC +ENV \ + NO_VNC_HOME=/usr/libexec/noVNCdim \ + NO_VNC_PORT="6901" + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + python-numpy \ + && mkdir -p ${NO_VNC_HOME}/utils/websockify \ + && wget -qO- https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz | tar xz --strip 1 -C ${NO_VNC_HOME} \ + && 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 \ + && ln -s /usr/bin/python2.7 /usr/bin/python + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + +### add 'index.html' for choosing noVNC client +RUN echo -e \ +"\n" \ +"\n" \ +" \n" \ +" noVNC\n" \ +" \n" \ +" \n" \ +" \n" \ +"

noVNC Lite Client

\n" \ +"

noVNC Full Client

\n" \ +" \n" \ +"" \ +> ${NO_VNC_HOME}/index.html + +EXPOSE ${NO_VNC_PORT} + + +############### +### FINAL STAGE +############### + +FROM ${ARG_FINAL_STAGE_BASE} as stage_final +ARG ARG_FEATURES_USER_GROUP_OVERRIDE +ARG ARG_HOME +ARG ARG_VNC_PW +ARG ARG_VNC_RESOLUTION +ARG ARG_VNC_VIEW_ONLY + +ENV \ + FEATURES_USER_GROUP_OVERRIDE=${ARG_FEATURES_USER_GROUP_OVERRIDE:+1} \ + FEATURES_VERSION_STICKER=1 + +ENV \ + DISPLAY=:1 \ + HOME=${ARG_HOME:-/home/headless} \ + STARTUPDIR=/dockerstartup \ + VNC_COL_DEPTH=24 \ + VNC_PORT="5901" \ + VNC_PW=${ARG_VNC_PW:-headless} \ + VNC_RESOLUTION=${ARG_VNC_RESOLUTION:-1360x768} \ + VNC_VIEW_ONLY=${ARG_VNC_VIEW_ONLY:-false} + +WORKDIR ${HOME} + +COPY [ "./xfce/src/startup", "${STARTUPDIR}/" ] +COPY [ "./xfce/src/home/Desktop", "${HOME}/Desktop/" ] +COPY [ "./xfce/src/home/config/xfce4", "${HOME}/.config/xfce4/" ] + +### Create the default application user (non-root, but member of the group zero) +### and allow the group zero to modify '/etc/passwd' and '/etc/group'. +### Providing the build argument ARG_SUPPORT_USER_GROUP_OVERRIDE (set to anything) allows any user +### to modify both files and makes user group overriding possible (like 'run --user x:y'). +RUN \ + chmod 664 /etc/passwd /etc/group \ + && echo "headless:x:1001:0:Default:${HOME}:/bin/bash" >> /etc/passwd \ + && adduser headless sudo \ + && echo "headless:${VNC_PW}" | chpasswd \ + && ${ARG_FEATURES_USER_GROUP_OVERRIDE/*/chmod a+w /etc/passwd /etc/group} \ + && chmod +x "${STARTUPDIR}"/*.sh \ + && "${STARTUPDIR}"/set_user_permissions.sh "${STARTUPDIR}" "${HOME}" + +EXPOSE ${VNC_PORT} + +USER 1001 + +ENTRYPOINT [ "/usr/bin/tini", "--", "/dockerstartup/startup.sh" ] +# ENTRYPOINT [ "/usr/bin/tini", "--", "tail", "-f", "/dev/null" ] + + +################## +### METADATA STAGE +################## + +FROM stage_final as stage_metadata +ARG ARG_CREATED +ARG ARG_DOCKER_TAG +ARG ARG_VCS_REF +ARG ARG_VERSION_STICKER + +LABEL \ + org.opencontainers.image.authors="accetto" \ + org.opencontainers.image.created="${ARG_CREATED}" \ + org.opencontainers.image.description="Headless Ubuntu/Xfce containers with VNC/noVNC" \ + org.opencontainers.image.documentation="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.source="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.title="accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.vendor="https://github.com/accetto" \ + org.opencontainers.image.version="${ARG_DOCKER_TAG}" + +LABEL \ + org.label-schema.vcs-url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.label-schema.vcs-ref="${ARG_VCS_REF}" + +LABEL \ + any.accetto.version-sticker="${ARG_VERSION_STICKER}" diff --git a/docker/Dockerfile.xfce.chromium b/docker/Dockerfile.xfce.chromium new file mode 100644 index 0000000..7b35427 --- /dev/null +++ b/docker/Dockerfile.xfce.chromium @@ -0,0 +1,326 @@ +# syntax=docker/dockerfile:experimental + +ARG BASEIMAGE=ubuntu +ARG BASETAG=20.04 + +ARG ARG_FINAL_STAGE_BASE=stage_chromium + + +############### +### stage_cache +############### + +FROM ${BASEIMAGE}:${BASETAG} as stage_cache + +RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache +RUN apt-get update + # --mount=type=cache,target=/var/cache/apt \ + # --mount=type=cache,target=/var/lib/apt \ + + +#################### +### stage_essentials +#################### + +FROM ${BASEIMAGE}:${BASETAG} as stage_essentials + +SHELL ["/bin/bash", "-c"] + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y \ + jq \ + nano \ + psmisc \ + sudo \ + tini \ + wget + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # curl \ + # gdebi-core \ + # git \ + # inetutils-ping \ + # lsb-release \ + # net-tools \ + # unzip \ + # vim \ + # zip \ + + +################# +### stage_xserver +################# + +FROM stage_essentials as stage_xserver +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XSERVER=${ARG_APT_NO_RECOMMENDS:+1} + +ENV \ + NO_AT_BRIDGE=1 +# LANG='en_US.UTF-8' \ +# LANGUAGE='en_US:en' \ +# LC_ALL='en_US.UTF-8' + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + dbus-x11 \ + xauth \ + xinit \ + x11-xserver-utils \ + xdg-utils + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # x11-utils \ # adds 200MB! + + +############## +### stage_xfce +############## + +FROM stage_xserver as stage_xfce +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XFCE=${ARG_APT_NO_RECOMMENDS:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + xfce4 \ + xfce4-terminal + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # && apt-get purge -y \ + # pm-utils \ + # xscreensaver* \ + + +############### +### stage_tools +############### + +FROM stage_xfce as stage_tools +ARG ARG_APT_NO_RECOMMENDS +ARG ARG_FEATURES_SCREENSHOOTING +ARG ARG_FEATURES_THUMBNAILING + +ENV \ + FEATURES_BUILD_SLIM_TOOLS=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_SCREENSHOOTING=${ARG_FEATURES_SCREENSHOOTING:+1} \ + FEATURES_THUMBNAILING=${ARG_FEATURES_THUMBNAILING:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + mousepad \ + ${ARG_FEATURES_SCREENSHOOTING:+ristretto xfce4-screenshooter} \ + ${ARG_FEATURES_THUMBNAILING:+tumbler} + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # ristretto \ + # xfce4-screenshooter \ + # tumbler \ + + +############# +### stage_vnc +############# + +FROM stage_tools as stage_vnc + +ENV \ + FEATURES_VNC=1 + +### 2020-10-03: nightly builds fix some TigerVNC issues (e.g #1097) +# RUN wget -qO- https://dl.bintray.com/tigervnc/stable/tigervnc-1.11.0.x86_64.tar.gz | tar xz --strip 1 -C / \ +RUN \ + wget -qO- http://tigervnc.bphinz.com/nightly/xc/x86_64/tigervnc-1.11.80-20201209gita3d7d7d4.x86_64.tar.gz | tar xz --strip 1 -C / \ + && ln -s /usr/libexec/vncserver /usr/bin/vncserver \ + && sed -i 's/exec(@cmd);/print "@cmd";\nexec(@cmd);/g' /usr/libexec/vncserver + + +################## +### stage_chromium +################## + +FROM stage_vnc as stage_chromium +ARG ARG_APT_NO_RECOMMENDS + +### Switch to root user before install +USER 0 + +ENV \ + FEATURES_BUILD_SLIM_CHROMIUM=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_CHROMIUM=1 \ + CHROMIUM_VERSION="87.0.4280.66-0ubuntu0.18.04.1" + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + wget -q "http://archive.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg_${CHROMIUM_VERSION}_amd64.deb" -P /tmp \ + && wget -q "http://archive.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-browser_${CHROMIUM_VERSION}_amd64.deb" -P /tmp \ + && wget -q "http://archive.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-browser-l10n_${CHROMIUM_VERSION}_all.deb" -P /tmp \ + && apt-get update \ + && env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + "/tmp/chromium-codecs-ffmpeg_${CHROMIUM_VERSION}_amd64.deb" \ + "/tmp/chromium-browser_${CHROMIUM_VERSION}_amd64.deb" \ + "/tmp/chromium-browser-l10n_${CHROMIUM_VERSION}_all.deb" \ + && apt-get -y -f install \ + && rm \ + "/tmp/chromium-codecs-ffmpeg_${CHROMIUM_VERSION}_amd64.deb" \ + "/tmp/chromium-browser_${CHROMIUM_VERSION}_amd64.deb" \ + "/tmp/chromium-browser-l10n_${CHROMIUM_VERSION}_all.deb" \ + && apt-mark hold chromium-browser + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + +### This part has been moved to the final stage +### Chromium browser requires some presets +### Note that 'no-sandbox' flag is required, but intended for development only +# RUN echo "CHROMIUM_FLAGS='--no-sandbox --disable-gpu --user-data-dir --window-size=${VNC_RESOLUTION%x*},${VNC_RESOLUTION#*x} --window-position=0,0'" \ +# > ${HOME}/.chromium-browser.init + + +############### +### stage_novnc +############### + +FROM stage_chromium as stage_novnc +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_NOVNC=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_NOVNC=1 + +### using the same parent path as TigerVNC +ENV \ + NO_VNC_HOME=/usr/libexec/noVNCdim \ + NO_VNC_PORT="6901" + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + python-numpy \ + && mkdir -p ${NO_VNC_HOME}/utils/websockify \ + && wget -qO- https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz | tar xz --strip 1 -C ${NO_VNC_HOME} \ + && 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 \ + && ln -s /usr/bin/python2.7 /usr/bin/python + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + +### add 'index.html' for choosing noVNC client +RUN echo -e \ +"\n" \ +"\n" \ +" \n" \ +" noVNC\n" \ +" \n" \ +" \n" \ +" \n" \ +"

noVNC Lite Client

\n" \ +"

noVNC Full Client

\n" \ +" \n" \ +"" \ +> ${NO_VNC_HOME}/index.html + +EXPOSE ${NO_VNC_PORT} + + +############### +### FINAL STAGE +############### + +FROM ${ARG_FINAL_STAGE_BASE} as stage_final +ARG ARG_FEATURES_USER_GROUP_OVERRIDE +ARG ARG_HOME +ARG ARG_VNC_PW +ARG ARG_VNC_RESOLUTION +ARG ARG_VNC_VIEW_ONLY + +ENV \ + FEATURES_USER_GROUP_OVERRIDE=${ARG_FEATURES_USER_GROUP_OVERRIDE:+1} \ + FEATURES_VERSION_STICKER=1 + +ENV \ + DISPLAY=:1 \ + HOME=${ARG_HOME:-/home/headless} \ + STARTUPDIR=/dockerstartup \ + VNC_COL_DEPTH=24 \ + VNC_PORT="5901" \ + VNC_PW=${ARG_VNC_PW:-headless} \ + VNC_RESOLUTION=${ARG_VNC_RESOLUTION:-1360x768} \ + VNC_VIEW_ONLY=${ARG_VNC_VIEW_ONLY:-false} + +WORKDIR ${HOME} + +COPY [ "./xfce/src/startup", "${STARTUPDIR}/" ] +COPY [ "./xfce/src/home/Desktop", "${HOME}/Desktop/" ] +COPY [ "./xfce/src/home/config/xfce4", "${HOME}/.config/xfce4/" ] + +COPY [ "./xfce-chromium/src/startup", "${STARTUPDIR}/" ] +COPY [ "./xfce-chromium/src/home/Desktop", "${HOME}/Desktop/" ] + +### Chromium browser requires some presets +### Note that 'no-sandbox' flag is required, but intended for development only +RUN echo "CHROMIUM_FLAGS='--no-sandbox --disable-gpu --user-data-dir \ + --window-size=${VNC_RESOLUTION%x*},${VNC_RESOLUTION#*x} --window-position=0,0'" \ + > ${HOME}/.chromium-browser.init + +### Create the default application user (non-root, but member of the group zero) +### and allow the group zero to modify '/etc/passwd' and '/etc/group'. +### Providing the build argument ARG_SUPPORT_USER_GROUP_OVERRIDE (set to anything) allows any user +### to modify both files and makes user group overriding possible (like 'run --user x:y'). +RUN \ + chmod 664 /etc/passwd /etc/group \ + && echo "headless:x:1001:0:Default:${HOME}:/bin/bash" >> /etc/passwd \ + && adduser headless sudo \ + && echo "headless:${VNC_PW}" | chpasswd \ + && ${ARG_FEATURES_USER_GROUP_OVERRIDE/*/chmod a+w /etc/passwd /etc/group} \ + && chmod +x "${STARTUPDIR}"/*.sh \ + && "${STARTUPDIR}"/set_user_permissions.sh "${STARTUPDIR}" "${HOME}" + +EXPOSE ${VNC_PORT} + +USER 1001 + +ENTRYPOINT [ "/usr/bin/tini", "--", "/dockerstartup/startup.sh" ] +# ENTRYPOINT [ "/usr/bin/tini", "--", "tail", "-f", "/dev/null" ] + + +################## +### METADATA STAGE +################## + +FROM stage_final as stage_metadata +ARG ARG_CREATED +ARG ARG_DOCKER_TAG +ARG ARG_VCS_REF +ARG ARG_VERSION_STICKER + +LABEL \ + org.opencontainers.image.authors="accetto" \ + org.opencontainers.image.created="${ARG_CREATED}" \ + org.opencontainers.image.description="Headless Ubuntu/Xfce containers with VNC/noVNC and Chromium Browser" \ + org.opencontainers.image.documentation="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.source="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.title="accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.vendor="https://github.com/accetto" \ + org.opencontainers.image.version="${ARG_DOCKER_TAG}" + +LABEL \ + org.label-schema.vcs-url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.label-schema.vcs-ref="${ARG_VCS_REF}" + +LABEL \ + any.accetto.version-sticker="${ARG_VERSION_STICKER}" diff --git a/docker/Dockerfile.xfce.firefox b/docker/Dockerfile.xfce.firefox new file mode 100644 index 0000000..a564493 --- /dev/null +++ b/docker/Dockerfile.xfce.firefox @@ -0,0 +1,322 @@ +# syntax=docker/dockerfile:experimental + +ARG BASEIMAGE=ubuntu +ARG BASETAG=20.04 + +ARG ARG_FINAL_STAGE_BASE=stage_firefox +ARG ARG_METADATA_STAGE_BASE=stage_final + +############### +### stage_cache +############### + +FROM ${BASEIMAGE}:${BASETAG} as stage_cache + +RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache +RUN apt-get update + # --mount=type=cache,target=/var/cache/apt \ + # --mount=type=cache,target=/var/lib/apt \ + + +#################### +### stage_essentials +#################### + +FROM ${BASEIMAGE}:${BASETAG} as stage_essentials + +SHELL ["/bin/bash", "-c"] + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y \ + jq \ + nano \ + psmisc \ + sudo \ + tini \ + wget + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # curl \ + # gdebi-core \ + # git \ + # inetutils-ping \ + # lsb-release \ + # net-tools \ + # unzip \ + # vim \ + # zip \ + + +################# +### stage_xserver +################# + +FROM stage_essentials as stage_xserver +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XSERVER=${ARG_APT_NO_RECOMMENDS:+1} + +ENV \ + NO_AT_BRIDGE=1 +# LANG='en_US.UTF-8' \ +# LANGUAGE='en_US:en' \ +# LC_ALL='en_US.UTF-8' + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + dbus-x11 \ + xauth \ + xinit \ + x11-xserver-utils \ + xdg-utils + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # x11-utils \ # adds 200MB! + + +############## +### stage_xfce +############## + +FROM stage_xserver as stage_xfce +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_XFCE=${ARG_APT_NO_RECOMMENDS:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + xfce4 \ + xfce4-terminal + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # && apt-get purge -y \ + # pm-utils \ + # xscreensaver* \ + + +############### +### stage_tools +############### + +FROM stage_xfce as stage_tools +ARG ARG_APT_NO_RECOMMENDS +ARG ARG_FEATURES_SCREENSHOOTING +ARG ARG_FEATURES_THUMBNAILING + +ENV \ + FEATURES_BUILD_SLIM_TOOLS=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_SCREENSHOOTING=${ARG_FEATURES_SCREENSHOOTING:+1} \ + FEATURES_THUMBNAILING=${ARG_FEATURES_THUMBNAILING:+1} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + mousepad \ + ${ARG_FEATURES_SCREENSHOOTING:+ristretto xfce4-screenshooter} \ + ${ARG_FEATURES_THUMBNAILING:+tumbler} + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + # ristretto \ + # xfce4-screenshooter \ + # tumbler \ + + +############# +### stage_vnc +############# + +FROM stage_tools as stage_vnc + +ENV \ + FEATURES_VNC=1 + +### 2020-10-03: nightly builds fix some TigerVNC issues (e.g #1097) +# RUN wget -qO- https://dl.bintray.com/tigervnc/stable/tigervnc-1.11.0.x86_64.tar.gz | tar xz --strip 1 -C / \ +RUN \ + wget -qO- http://tigervnc.bphinz.com/nightly/xc/x86_64/tigervnc-1.11.80-20201209gita3d7d7d4.x86_64.tar.gz | tar xz --strip 1 -C / \ + && ln -s /usr/libexec/vncserver /usr/bin/vncserver \ + && sed -i 's/exec(@cmd);/print "@cmd";\nexec(@cmd);/g' /usr/libexec/vncserver + + +################# +### stage_firefox +################# + +FROM stage_vnc as stage_firefox +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_FIREFOX=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_FIREFOX=1 \ + HOME=${ARG_HOME:-/home/headless} + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + firefox + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + + +############### +### stage_novnc +############### + +FROM stage_firefox as stage_novnc +ARG ARG_APT_NO_RECOMMENDS + +ENV \ + FEATURES_BUILD_SLIM_NOVNC=${ARG_APT_NO_RECOMMENDS:+1} \ + FEATURES_NOVNC=1 + +### using the same parent path as TigerVNC +ENV \ + NO_VNC_HOME=/usr/libexec/noVNCdim \ + NO_VNC_PORT="6901" + +RUN \ + --mount=type=cache,target=/var/cache/apt,from=stage_cache,source=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt,from=stage_cache,source=/var/lib/apt \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y ${ARG_APT_NO_RECOMMENDS:+--no-install-recommends} \ + python-numpy \ + && mkdir -p ${NO_VNC_HOME}/utils/websockify \ + && wget -qO- https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz | tar xz --strip 1 -C ${NO_VNC_HOME} \ + && 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 \ + && ln -s /usr/bin/python2.7 /usr/bin/python + # && apt-get -y autoremove \ + # && rm -rf /var/lib/apt/lists/* + +### add 'index.html' for choosing noVNC client +RUN echo -e \ +"\n" \ +"\n" \ +" \n" \ +" noVNC\n" \ +" \n" \ +" \n" \ +" \n" \ +"

noVNC Lite Client

\n" \ +"

noVNC Full Client

\n" \ +" \n" \ +"" \ +> ${NO_VNC_HOME}/index.html + +EXPOSE ${NO_VNC_PORT} + + +############### +### FINAL STAGE +############### + +FROM ${ARG_FINAL_STAGE_BASE} as stage_final +ARG ARG_FEATURES_USER_GROUP_OVERRIDE +ARG ARG_HOME +ARG ARG_VNC_PW +ARG ARG_VNC_RESOLUTION +ARG ARG_VNC_VIEW_ONLY + +ENV \ + FEATURES_USER_GROUP_OVERRIDE=${ARG_FEATURES_USER_GROUP_OVERRIDE:+1} \ + FEATURES_VERSION_STICKER=1 + +ENV \ + DISPLAY=:1 \ + STARTUPDIR=/dockerstartup \ + VNC_COL_DEPTH=24 \ + VNC_PORT="5901" \ + VNC_PW=${ARG_VNC_PW:-headless} \ + VNC_RESOLUTION=${ARG_VNC_RESOLUTION:-1360x768} \ + VNC_VIEW_ONLY=${ARG_VNC_VIEW_ONLY:-false} + # HOME=${ARG_HOME:-/home/headless} \ + +WORKDIR ${HOME} + +COPY [ "./xfce/src/startup", "${STARTUPDIR}/" ] +COPY [ "./xfce/src/home/Desktop", "${HOME}/Desktop/" ] +COPY [ "./xfce/src/home/config/xfce4", "${HOME}/.config/xfce4/" ] + +COPY [ "./xfce-firefox/src/startup", "${STARTUPDIR}/" ] +COPY [ "./xfce-firefox/src/home/Desktop", "${HOME}/Desktop/" ] + +### Create the default application user (non-root, but member of the group zero) +### and allow the group zero to modify '/etc/passwd' and '/etc/group'. +### Providing the build argument ARG_SUPPORT_USER_GROUP_OVERRIDE (set to anything) allows any user +### to modify both files and makes user group overriding possible (like 'run --user x:y'). +RUN \ + chmod 664 /etc/passwd /etc/group \ + && echo "headless:x:1001:0:Default:${HOME}:/bin/bash" >> /etc/passwd \ + && adduser headless sudo \ + && echo "headless:${VNC_PW}" | chpasswd \ + && ${ARG_FEATURES_USER_GROUP_OVERRIDE/*/chmod a+w /etc/passwd /etc/group} \ + && chmod +x "${STARTUPDIR}"/*.sh \ + && "${STARTUPDIR}"/set_user_permissions.sh "${STARTUPDIR}" "${HOME}" + +EXPOSE ${VNC_PORT} + +USER 1001 + +ENTRYPOINT [ "/usr/bin/tini", "--", "/dockerstartup/startup.sh" ] +# ENTRYPOINT [ "/usr/bin/tini", "--", "tail", "-f", "/dev/null" ] + + +##################### +### stage_firefoxplus +##################### + +FROM stage_final as stage_firefox_plus + +ENV \ + FEATURES_FIREFOX_PLUS=1 + +USER 0 + +COPY [ "./xfce-firefox/src/firefox.plus/resources", "${HOME}/firefox.plus" ] +COPY [ "./xfce-firefox/src/firefox.plus/resources/*.svg", "/usr/share/icons/hicolor/scalable/apps/"] +COPY [ "./xfce-firefox/src/firefox.plus/home/Desktop", "${HOME}/Desktop/" ] + +RUN \ + chmod +x ${HOME}/firefox.plus/*.sh \ + && gtk-update-icon-cache -f /usr/share/icons/hicolor \ + && "${STARTUPDIR}"/set_user_permissions.sh "${HOME}" + +USER 1001 + + +################## +### METADATA STAGE +################## + +FROM ${ARG_METADATA_STAGE_BASE} as stage_metadata +ARG ARG_CREATED +ARG ARG_DOCKER_TAG +ARG ARG_VCS_REF +ARG ARG_VERSION_STICKER + +LABEL \ + org.opencontainers.image.authors="accetto" \ + org.opencontainers.image.created="${ARG_CREATED}" \ + org.opencontainers.image.description="Headless Ubuntu/Xfce containers with VNC/noVNC and Firefox Browser" \ + org.opencontainers.image.documentation="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.source="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.title="accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.opencontainers.image.vendor="https://github.com/accetto" \ + org.opencontainers.image.version="${ARG_DOCKER_TAG}" + +LABEL \ + org.label-schema.vcs-url="https://github.com/accetto/ubuntu-vnc-xfce-g3" \ + org.label-schema.vcs-ref="${ARG_VCS_REF}" + +LABEL \ + any.accetto.version-sticker="${ARG_VERSION_STICKER}" diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..59a6fe9 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,3 @@ +# README placeholder + +This placeholder will be replaced by the image deployment workflow. diff --git a/docker/hooks/build b/docker/hooks/build new file mode 100644 index 0000000..d9ac036 --- /dev/null +++ b/docker/hooks/build @@ -0,0 +1,46 @@ +#!/bin/bash -e + +declare _mydir=$(dirname $0) +source "${_mydir}"/env.rc +source "${_mydir}"/util.rc + +main() { + + if [ -f "${_build_context}/${_scrap_demand_stop_building}" ] ; then + echo "Skipping build on demand." + return 0 + fi + + local now + local version_sticker + + if [ -f "${_build_context}/${_scrap_version_sticker_current}" ] ; then + version_sticker="$( cat ${_build_context}/${_scrap_version_sticker_current} )" + else + version_sticker="null" + fi + + now="$(date --utc +%FT%TZ)" + echo "Current timestamp: ${now}" ; echo + + set -x + docker build $@ \ + -f "${DOCKERFILE_PATH}" \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ + --build-arg BASEIMAGE="${BASEIMAGE}" \ + --build-arg BASETAG="${BASETAG}" \ + ${FEATURES_BUILD_SLIM:+--build-arg ARG_APT_NO_RECOMMENDS=1} \ + ${FEATURES_SCREENSHOOTING:+--build-arg ARG_FEATURES_SCREENSHOOTING=1} \ + ${FEATURES_THUMBNAILING:+--build-arg ARG_FEATURES_THUMBNAILING=1} \ + ${FEATURES_USER_GROUP_OVERRIDE:+--build-arg ARG_FEATURES_USER_GROUP_OVERRIDE=1} \ + ${FEATURES_NOVNC:+--build-arg ARG_FINAL_STAGE_BASE="stage_novnc"} \ + ${FEATURES_FIREFOX_PLUS:+--build-arg ARG_METADATA_STAGE_BASE="stage_firefox_plus"} \ + --build-arg ARG_CREATED="${now}" \ + --build-arg ARG_DOCKER_TAG=${DOCKER_TAG} \ + --build-arg ARG_VERSION_STICKER="${version_sticker}" \ + --build-arg ARG_VCS_REF="$(git rev-parse --short HEAD)" \ + -t "${DOCKER_REPO}":"${DOCKER_TAG}" "${_build_context}" + set +x +} + +main $@ diff --git a/docker/hooks/env.rc b/docker/hooks/env.rc new file mode 100644 index 0000000..25b77c3 --- /dev/null +++ b/docker/hooks/env.rc @@ -0,0 +1,194 @@ +### All variables in capitals can be set also by environment. + +### build context is the path to the Dockerfile +### it is expected that '_mydir' is already set by the calling script +declare _build_context="$(dirname ${_mydir})" + +### Docker Hub: GitHub source branch to use +### local: virtual source branch (technically always the current git branch) +declare _branch="${SOURCE_BRANCH:-$1}" + +### which image variation to build (feature blend) +declare _blend="${DOCKER_TAG:-$2}" + +### building stage +declare _stage + +if [ $# -ge 2 ] ; then + + shift 2 + _stage="local" + + ### supporting local testing of the complete CI workflow + if [ -f "${_build_context}"/hooks/secrets.rc ] ; then + source "${_build_context}"/hooks/secrets.rc + fi + +else + _stage="dockerhub" +fi + +### owner of the builder and deployment repositories must be the same +declare _owner="accetto" + +### 'DOCKER_REPO' is the repository where the image is built (builder repository) +### it is initialized by the environment on Docker Hub +### example: 'index.docker.io/accetto/ubuntu-vnc-xfce-g3' by building on Docker Hub +### example: 'local/ubuntu-g3' by building locally +DOCKER_REPO=${DOCKER_REPO:-${_owner}/dev-ubuntu-vnc-xfce-g3} + +### 'DOCKER_TAG' is the tag in the repository where the image is built +DOCKER_TAG="${_blend}" + +### '_deploy_repo' is the repository where the image will be (additionally) deployed (deployment repository) +### deploy repository could be also identical with the builder repository +# declare _deploy_repo="${DOCKER_REPO}" +# declare _deploy_repo="${_owner}/${DEPLOY_REPO:-ubuntu-vnc-xfce-g3}" +declare _deploy_repo + +### array of the image tags to be deployed +declare -a _deploy_tags + +### relative path to the readme file resources (relative to the project root) +declare _readme_context + +### GitHub repo and branch containing the post_push workflow to trigger +POST_PUSH_WORKFLOW_REPO=${POST_PUSH_WORKFLOW_REPO:-"ubuntu-vnc-xfce-g3"} +POST_PUSH_WORKFLOW_BRANCH=${POST_PUSH_WORKFLOW_BRANCH:-"master"} + +### examples +# VERSION_STICKER_PREFIX=${VERSION_STICKER_SUFFIX:-"LOCAL-"} +# VERSION_STICKER_SUFFIX=${VERSION_STICKER_SUFFIX:-"-BETA"} + +### Features can be enabled or disabled by setting the related variables. +### Setting it to "0" disables the feature. +### Setting it to "1" enforces the feature. +### Anything else, including null and empty string, does not change the feature's default value. +### NOTE: They are also other feature environment variables that are set directly in the Dockerfile. +### FEATURES_BUILD_SLIM: if to add '--no-install-recommends' to 'apt-get install' +### FEATURES_NOVNC: if 'noVNC' and 'websockify' (+62.0MB) should be included +### FEATURES_SCREENSHOOTING: if 'xfce4-screenshooter' (+2.0MB) and 'ristretto' (+43.0MB) should be included +### FEATURES_THUMBNAILING: if 'tumbler' (+19.0MB) should be included +### FEATURES_USER_GROUP_OVERRIDE: if overriding container's user group should be supported +### Remark: There are also 'FEATURES_*' variables that are always set, e.g. 'FEATURES_VERSION_STICKER=1'. + +### These features influence the content of almost all stages: +if [ "${FEATURES_BUILD_SLIM}" == "0" ] ; then FEATURES_BUILD_SLIM="" ; else FEATURES_BUILD_SLIM=1 ; fi + +### These features influence the building graph: +if [ "${FEATURES_NOVNC}" == "1" ] ; then FEATURES_NOVNC=1 ; else FEATURES_NOVNC="" ; fi + +### These features influence the content of the related stages: +if [ "${FEATURES_SCREENSHOOTING}" == "1" ] ; then FEATURES_SCREENSHOOTING=1 ; else FEATURES_SCREENSHOOTING="" ; fi +if [ "${FEATURES_THUMBNAILING}" == "1" ] ; then FEATURES_THUMBNAILING=1 ; else FEATURES_THUMBNAILING="" ; fi + +### These features influence user permissions inside the image: +if [ "${FEATURES_USER_GROUP_OVERRIDE}" == "1" ] ; then FEATURES_USER_GROUP_OVERRIDE=1 ; else FEATURES_USER_GROUP_OVERRIDE="" ; fi + +### The reason for this 'case' is to support some special branches/builds if required. +case "${_branch}" in + + ### default (master), developer (dev, dev-*) and release (v*) builds + master | dev | dev-* | v* ) + + BASEIMAGE=${BASEIMAGE:-"ubuntu"} + BASETAG=${BASETAG:-"20.04"} + + ### 'DOCKERFILE_PATH' is set by the environment on Docker Hub (relative to the build context) + ### example: DOCKERFILE_PATH=Dockerfile + # DOCKERFILE_PATH=${DOCKERFILE_PATH} + + case "${_blend}" in + + ### ------------------ + ### ubuntu-vnc-xfce-g3 + ### ------------------ + vnc ) + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-g3" + _deploy_tags=( "vnc" ) + _readme_context="docker/xfce" + ;; + latest | vnc-novnc ) + FEATURES_NOVNC=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-g3" + _deploy_tags=( "latest" "vnc-novnc" ) + _readme_context="docker/xfce" + ;; + vnc-fugo ) + FEATURES_USER_GROUP_OVERRIDE=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-g3" + _deploy_tags=( "vnc-fugo" ) + _readme_context="docker/xfce" + ;; + vnc-novnc-fugo ) + FEATURES_NOVNC=1 + FEATURES_USER_GROUP_OVERRIDE=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-g3" + _deploy_tags=( "vnc-novnc-fugo" ) + _readme_context="docker/xfce" + ;; + + ### --------------------------- + ### ubuntu-vnc-xfce-chromium-g3 + ### --------------------------- + vnc-chromium ) + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.chromium" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-chromium-g3" + _deploy_tags=( "vnc" ) + _readme_context="docker/xfce-chromium" + ;; + latest-chromium | vnc-novnc-chromium ) + FEATURES_NOVNC=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.chromium" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-chromium-g3" + _deploy_tags=( "latest" "vnc-novnc" ) + _readme_context="docker/xfce-chromium" + ;; + + ### -------------------------- + ### ubuntu-vnc-xfce-firefox-g3 + ### -------------------------- + vnc-firefox ) + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.firefox" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-firefox-g3" + _deploy_tags=( "vnc" ) + _readme_context="docker/xfce-firefox" + ;; + vnc-novnc-firefox ) + FEATURES_NOVNC=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.firefox" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-firefox-g3" + _deploy_tags=( "vnc-novnc" ) + _readme_context="docker/xfce-firefox" + ;; + vnc-firefox-plus ) + FEATURES_FIREFOX_PLUS=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.firefox" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-firefox-g3" + _deploy_tags=( "vnc-plus" ) + _readme_context="docker/xfce-firefox" + ;; + latest-firefox | vnc-novnc-firefox-plus ) + FEATURES_NOVNC=1 + FEATURES_FIREFOX_PLUS=1 + DOCKERFILE_PATH="${_build_context}/Dockerfile.xfce.firefox" + _deploy_repo="${_owner}/ubuntu-vnc-xfce-firefox-g3" + _deploy_tags=( "vnc-novnc-plus" "latest" ) + _readme_context="docker/xfce-firefox" + ;; + + *) + echo "Unsupported blend '${_blend}'" + exit 1 + ;; + esac + ;; + *) + echo "Unsupported branch '${_branch}'" + exit 1 + ;; +esac diff --git a/docker/hooks/example-secrets.rc b/docker/hooks/example-secrets.rc new file mode 100644 index 0000000..d293d69 --- /dev/null +++ b/docker/hooks/example-secrets.rc @@ -0,0 +1,78 @@ +### This files configures the environment (including secrets!) for building images locally. +### Source this file before building. +### Rename it to "secrets.rc" (or similar) and **make sure** that the '.gitignore' and '.dockerignore' files +### contain the 'secret*' exclusion pattern! You do not need this file on Docker Hub! There you have +### to configure only some of these environment variables (see the comments). +### Example: source ./secrets.rc +### This file is also automatically sourced by the 'hooks/env.rc' script. + +### recommended also on Docker Hub +export DOCKER_BUILDKIT=1 +# export DOCKER_BUILDKIT=0 +# export COMPOSE_DOCKER_CLI_BUILD=0 + +### optional on Docker Hub +# export VERSION_STICKER_PREFIX="LOCAL-BETA-" +# export VERSION_STICKER_SUFFIX="-BETA" + +### optional on Docker Hub +### will force re-building regardless of verbose version sticker changes +# export FORCE_BUILDING=1 + +### optional on Docker Hub +### will force README re-publishing regardless of verbose version sticker changes +# export FORCE_README_PUBLISHING=1 + +### optional on Docker Hub +### GitHub repo and branch containing the post_push workflow to trigger +export POST_PUSH_WORKFLOW_REPO="ubuntu-vnc-xfce-g3" +export POST_PUSH_WORKFLOW_BRANCH="master" + +### required on Docker Hub +### these are not real secrets because they are also used in the badge links in readme files +### builder and deployment gists could be also identical +### builder gist (@ubuntu-vnc-xfce-g3-builder) +export GIST_ID="xxxxxx" +### deployment gist (@ubuntu-vnc-xfce-g3-deployment) +export DEPLOY_GIST_ID="xxxxxx" + +### ------------ +### REAL SECRETS +### ------------ + +### required on Docker Hub +### !!! REAL SECRET !!! +### GitHub: Settings/Developer settings/Personal access tokens +### PTA name: ubuntu-vnc-xfce-g3-gist +### this token must have scope 'gist' +### warning! gist token is valid for all gits of the same owner! +export GIST_TOKEN="xxxxxx" + +### required on Docker Hub +### !!! REAL SECRET !!! +### GitHub: Settings/Developer settings/Personal access tokens +### PTA name: ubuntu-vnc-xfce-g3-actions +### this PAT must have scopes 'repo' and 'workflow' +export POST_PUSH_WORKFLOW_TOKEN="xxxxxx" + +### required on GitHub as repo secrets, these exports are for local use only +### !!! REAL SECRETS !!! +### required for publishing readme files, because the Docker Hub API doesn't support PAT tokens +### warning! this credentials are valid for all Docker Hub repositories of the same owner! +export DOCKERHUB_USERNAME="xxxxxx" +export DOCKERHUB_PASSWORD="xxxxxx" + +### ------------------------------------- +### Secrets for 'dockerhub-autobuild.yml' +### ------------------------------------- + +### these secrets must be defined in the GitHub repository itself + +### required on Dockerhub (as a webhook) and on GitHub (as a secret) +### Docker Hub's webhook URL for triggering the auto-builds +### ${{ secrets.DockerHubWebhookBuildRelease }} similar to 'https://hub.docker.com/api/build/v1/source/xxxx/trigger/xxxx/call/' + +### required on GitHub (as repo secrets) +### credentials needed for publishing the readme files (API does not accept PTA) +### ${{ secrets.DOCKERHUB_USERNAME }} real Docker Hub account name +### ${{ secrets.DOCKERHUB_PASSWORD }} real Docker Hub account password diff --git a/docker/hooks/post_push b/docker/hooks/post_push new file mode 100644 index 0000000..2d77024 --- /dev/null +++ b/docker/hooks/post_push @@ -0,0 +1,93 @@ +#!/bin/bash -e + +declare _mydir=$(dirname $0) +source "${_mydir}"/env.rc +source "${_mydir}"/util.rc + +main() { + ### There is a secret gist on GitHub containing endpoints for the badges. + ### Updating the gist could be skipped by *not* setting these environment variables. + ### The required scope for the 'GIST_TOKEN' (PAT) is 'gist'. + + local created + local version_sticker + local version_sticker_verbose + + ### debugging support + # dump_environment + + if [ -f "${_build_context}/${_scrap_demand_stop_building}" ] ; then + + if [ "${FORCE_README_PUBLISHING}" != "1" ] ; then + + echo "Skipping post_push on demand." + + else + ### get values for badges from the image metadata (labels) + created=$( get_label "${DOCKER_REPO}:${DOCKER_TAG}" "org.opencontainers.image.created" ) + version_sticker=$( get_label "${DOCKER_REPO}:${DOCKER_TAG}" "any.accetto.version-sticker" ) + version_sticker_verbose=$( cat "${_build_context}/${_scrap_version_sticker_verbose_current}" ) + + ### trigger the GitHub Actions workflow to push the readme file into the deployment repository + ### essential environment variables must be already set + if [ -n "${POST_PUSH_WORKFLOW_BRANCH}" ] && [ -n "${POST_PUSH_WORKFLOW_TOKEN}" ] ; then + + ### 'git branch --show-current' helps by testing local building + ### note that only the main builder tag is sent to the workflow + trigger_post_push_workflow "${_deploy_repo}" "${DOCKER_TAG}" "${DEPLOY_GIST_ID}" \ + "${_readme_context}" "${POST_PUSH_WORKFLOW_BRANCH}" \ + "${created}" "${version_sticker}" "${version_sticker_verbose}" 1 + else + echo "Skipping build workflow trigger. Required variables not set." + fi + fi + else + ### essential environment variables must be already set + if [ -n "${GIST_TOKEN}" ] && [ -n "${GIST_ID}" ] && [ -n "${DEPLOY_GIST_ID}" ] ; then + + ### get values for badges from the image metadata (labels) + created=$( get_label "${DOCKER_REPO}:${DOCKER_TAG}" "org.opencontainers.image.created" ) + version_sticker=$( get_label "${DOCKER_REPO}:${DOCKER_TAG}" "any.accetto.version-sticker" ) + version_sticker_verbose=$( cat "${_build_context}/${_scrap_version_sticker_verbose_current}" ) + + ### update badge endpoints in the builder repository gist + update_gist "${GIST_ID}" "${_gist_key_created}" "${DOCKER_REPO}" "${DOCKER_TAG}" "${created}" + update_gist "${GIST_ID}" "${_gist_key_version_sticker}" "${DOCKER_REPO}" "${DOCKER_TAG}" "${version_sticker}" + update_gist "${GIST_ID}" "${_gist_key_version_sticker_verbose}" "${DOCKER_REPO}" "${DOCKER_TAG}" "${version_sticker_verbose}" + + ### update badge endpoints for all tags in the deployment repository + for t in "${_deploy_tags[@]}" ; do + + ### note that the builder and deployment repositories could be identical + ### in that case skip the tag which has been already published above + if [ "${DOCKER_REPO}" != "${_deploy_repo}" ] || [ "${DOCKER_TAG}" != "${t}" ] ; then + + update_gist "${DEPLOY_GIST_ID}" "${_gist_key_created}" "${_deploy_repo}" "${t}" "${created}" + update_gist "${DEPLOY_GIST_ID}" "${_gist_key_version_sticker}" "${_deploy_repo}" "${t}" "${version_sticker}" + update_gist "${DEPLOY_GIST_ID}" "${_gist_key_version_sticker_verbose}" "${_deploy_repo}" "${t}" "${version_sticker_verbose}" + fi + done + + ### trigger the GitHub Actions workflow to push the readme file into the deployment repository + ### essential environment variables must be already set + if [ -n "${POST_PUSH_WORKFLOW_BRANCH}" ] && [ -n "${POST_PUSH_WORKFLOW_TOKEN}" ] ; then + + ### 'git branch --show-current' helps by testing local building + ### note that only the main builder tag is sent to the workflow + trigger_post_push_workflow "${_deploy_repo}" "${DOCKER_TAG}" "${DEPLOY_GIST_ID}" \ + "${_readme_context}" "${POST_PUSH_WORKFLOW_BRANCH}" \ + "${created}" "${version_sticker}" "${version_sticker_verbose}" 1 + + else + echo "Skipping build workflow trigger. Required variables not set." + fi + else + echo "Skipping gist update. Required variables not set." + fi + fi + + echo "Removing helper files..." + cleanup_scrap_files +} + +main $@ diff --git a/docker/hooks/pre_build b/docker/hooks/pre_build new file mode 100644 index 0000000..bbbf5bc --- /dev/null +++ b/docker/hooks/pre_build @@ -0,0 +1,83 @@ +#!/bin/bash -e + +declare _mydir=$(dirname $0) +source "${_mydir}"/env.rc +source "${_mydir}"/util.rc + +main() { + local helper_suffix="_helper" + local now + local version_sticker + + local should_build=${FORCE_BUILDING} + + ### debugging support + # dump_environment + + echo "Removing helper files..." + cleanup_scrap_files + + ### build a temporary helper image for getting the current version sticker values + set -x + docker build $@ \ + -f "${DOCKERFILE_PATH}" \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ + --build-arg BASEIMAGE="${BASEIMAGE}" \ + --build-arg BASETAG="${BASETAG}" \ + ${FEATURES_BUILD_SLIM:+--build-arg ARG_APT_NO_RECOMMENDS=1} \ + ${FEATURES_SCREENSHOOTING:+--build-arg ARG_FEATURES_SCREENSHOOTING=1} \ + ${FEATURES_THUMBNAILING:+--build-arg ARG_FEATURES_THUMBNAILING=1} \ + ${FEATURES_USER_GROUP_OVERRIDE:+--build-arg ARG_FEATURES_USER_GROUP_OVERRIDE=1} \ + ${FEATURES_NOVNC:+--build-arg ARG_FINAL_STAGE_BASE="stage_novnc"} \ + ${FEATURES_FIREFOX_PLUS:+--build-arg ARG_METADATA_STAGE_BASE="stage_firefox_plus"} \ + -t "${DOCKER_REPO}":"${DOCKER_TAG}${helper_suffix}" "${_build_context}" + set +x + + ### get the actual verbose version sticker value from the helper image and store it as the current one + version_sticker="$( docker run --rm ${DOCKER_REPO}:${DOCKER_TAG}${helper_suffix} --skip-vnc --version-sticker-verbose )" + echo "${version_sticker}" > "${_build_context}/${_scrap_version_sticker_verbose_current}" + echo -e "Current verbose version sticker:\n$( cat ${_build_context}/${_scrap_version_sticker_verbose_current} )" + + if [ "${should_build}" == "1" ] ; then + + echo ; echo "Building of new image has been forced." + + else + + echo; echo "Building of new image has not been forced." + + echo "Getting the previous verbose version sticker value from the builder repository gist..." + get_gist_file "${GIST_ID}" "${DOCKER_REPO}" "${DOCKER_TAG}" "version-sticker-verbose.txt" "${_build_context}/${_scrap_version_sticker_verbose_previous}" + + echo "Comparing verbose version stickers..." + if cmp -s "${_build_context}/${_scrap_version_sticker_verbose_current}" "${_build_context}/${_scrap_version_sticker_verbose_previous}" ; then + + ### verbose version sticker hasn't changed since the last build - stop building + echo "Verbose version sticker has not changed since the last build, no need for building a new image." ; echo + + ### if this file is present, the building will not continue + echo "Demanding building stop..." + touch "${_build_context}/${_scrap_demand_stop_building}" + + else + ### verbose version sticker has changed since the last build - a new image should be built + echo "Verbose version sticker has changed, a new image will be built." + should_build="1" + fi + fi + + if [ "${should_build}" == "1" ] ; then + + ### get also the actual short version sticker value from the helper image and store it as the current one + ### note that some apps require a display to report their versions correctly, do not use '--skip-vnc' then + version_sticker="$( docker run --rm ${DOCKER_REPO}:${DOCKER_TAG}${helper_suffix} --skip-vnc --version-sticker )" + echo -n "${VERSION_STICKER_PREFIX}${version_sticker}${VERSION_STICKER_SUFFIX}" > "${_build_context}/${_scrap_version_sticker_current}" + echo "Current version sticker: $( cat ${_build_context}/${_scrap_version_sticker_current} )" + fi + + ### delete the helper image in any case + echo; echo "Removing helper image..." + docker rmi "${DOCKER_REPO}":"${DOCKER_TAG}${helper_suffix}" +} + +main $@ diff --git a/docker/hooks/push b/docker/hooks/push new file mode 100644 index 0000000..91f31b7 --- /dev/null +++ b/docker/hooks/push @@ -0,0 +1,65 @@ +#!/bin/bash -e + +declare _mydir=$(dirname $0) +source "${_mydir}"/env.rc +source "${_mydir}"/util.rc + +builder_push() { + + echo ; echo "Pushing builder image ${DOCKER_REPO}:${DOCKER_TAG}" + docker push ${DOCKER_REPO}:${DOCKER_TAG} +} + +deployment_push() { + local target + + ### push all target tags into the deployment repository + for t in "${_deploy_tags[@]}" ; do + + ### note that the builder and deployment repositories could be identical + ### in that case skip the tag which has been already published above + if [ "${DOCKER_REPO}" != "${_deploy_repo}" ] || [ "${DOCKER_TAG}" != "${t}" ] ; then + + target="${_deploy_repo}:${t}" + + echo ; echo "Deploying image '${target}'" + docker tag "${DOCKER_REPO}:${DOCKER_TAG}" "${target}" + docker push "${target}" + fi + done +} + +main() { + local target + + if [ -f "${_build_context}/${_scrap_demand_stop_building}" ] ; then + echo "Skipping push on demand." + return 0 + fi + + if [ "${_stage}" == "local" ] ; then + if [ -n "${DOCKERHUB_USERNAME}" ] && [ -n "${DOCKERHUB_PASSWORD}" ] ; then + + echo "Logging-in on Docker Hub..." + echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin + if [ ! $? ] ; then + echo "Docker Hub login failed" + return 1 + fi + else + echo "Local pushing requires Docker Hub login." + echo "However, your environment does not provide required authentication data." + return 1 + fi + fi + + ### push image into the builder repository + if [ "${_stage}" != "local" ] ; then builder_push ; fi + + ### push images into the deployment repository + deployment_push + + if [ "${_stage}" == "local" ] ; then docker logout ; fi +} + +main $@ diff --git a/docker/hooks/util.rc b/docker/hooks/util.rc new file mode 100644 index 0000000..56ec701 --- /dev/null +++ b/docker/hooks/util.rc @@ -0,0 +1,256 @@ +### prefix for temporary scrap files +declare _scrap_prefix=${SCRAP_PREFIX:-scrap-} + +### temporary scrap helper files +declare _scrap_version_sticker_current="${_scrap_prefix}version_sticker_current.tmp" +declare _scrap_version_sticker_verbose_current="${_scrap_prefix}version_sticker-verbose_current.tmp" +declare _scrap_version_sticker_verbose_previous="${_scrap_prefix}version_sticker-verbose_previous.tmp" +declare _scrap_demand_stop_building="${_scrap_prefix}demand-stop-building" + +### gist file keys +declare _gist_key_created="created.json" +declare _gist_key_version_sticker="version-sticker.json" +declare _gist_key_version_sticker_verbose="version-sticker-verbose.txt" + +### other configuration data +declare _post_push_workflow_file="dockerhub-post-push.yml" + +cleanup_scrap_files() { + rm -f "${_build_context}/${_scrap_prefix}"* +} + +dump_environment() { + ### List the selected environment variables. + ### Just debugging support. + + echo "Environment dump:" + echo "_build_context=${_build_context}" + echo "_branch=${_branch}" + echo "_blend=${_blend}" + + echo "_owner=${_owner}" + echo "DOCKER_REPO=${DOCKER_REPO}" + echo "DOCKER_TAG=${DOCKER_TAG}" + echo "_deploy_repo=${_deploy_repo}" + echo "_deploy_tags=${_deploy_tags[@]}" + + echo "FEATURES_BUILD_SLIM=${FEATURES_BUILD_SLIM}" + echo "FEATURES_JQ=${FEATURES_JQ}" + echo "FEATURES_NOVNC=${FEATURES_NOVNC}" + echo "FEATURES_SCREENSHOOTING=${FEATURES_SCREENSHOOTING}" + echo "FEATURES_THUMBNAILING=${FEATURES_THUMBNAILING}" + echo "FEATURES_USER_GROUP_OVERRIDE=${FEATURES_USER_GROUP_OVERRIDE}" + + echo "DOCKERFILE_PATH=${DOCKERFILE_PATH}" + echo "BASEIMAGE=${BASEIMAGE}" + echo "BASETAG=${BASETAG}" + echo "VERSION_STICKER_PREFIX=${VERSION_STICKER_PREFIX}" + echo "VERSION_STICKER_SUFFIX=${VERSION_STICKER_SUFFIX}" +} + +encode_json_quotes() { + ### Encode double-quotes for use in JSON + echo "${1//\"/\\\"}" +} + +encode_json_newlines() { + ### Encodes new-lines for use in JSON + echo $( echo -e "${1}" | sed -z 's/\n/\\n/g' ) +} + +get_label() { + ### Returning the given label value via the predefined global variable. + + local repotag="$1" + local label="$2" + + echo $( docker inspect "${repotag}" --format='{{ index .Config.Labels "'${label}'" }}' ) +} + +make_gist_filename() { + ### Returns correctly formatted gist member file name + + local repo="${1?Need repo}" + local tag="${2?Need repo tag}" + local filename="${3?Need file name}" + + echo "$(basename ${repo})"@"${tag}"@"${filename}" +} + +get_gist_file() { + ### Gets the specified file from the secret gist. + + local gist=${1?Need gist ID} + local repo="${2?Need repo}" + local tag="${3?Need repo tag}" + local filename="${4?Need file name}" + local output_file="${5?Need output file}" + + local gist_filename + local result + + gist_filename=$( make_gist_filename "${repo}" "${tag}" "${filename}" ) + + ### assumption: 'output_file' is the full file name correctly composed by the caller + result=$(curl -s \ + -X GET \ + --write-out "%{http_code}" \ + -o "${output_file}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://gist.githubusercontent.com/${_owner}/${gist}/raw/${gist_filename}") + + if [ "${result}" == "200" ] ; then + echo "Gist file '${gist_filename}' saved as '${output_file}'." + return 0 + elif [ "${result}" == "404" ] ; then + echo ; echo "Gist file '${gist_filename}' not found." + return 0 + else + echo "Getting gist file '${gist_filename}' failed: ${result}" + return 2 + fi +} + +list_labels() { + ### Listing all image labels. + ### Just debugging support. + + local repotag="$1" + + # docker inspect "${repotag}" --format='{{println}} {{ range $k, $v := .Config.Labels -}} {{ $k }}={{ $v }} {{println}} {{end -}}' + + docker inspect "${repotag}" --format=' + {{ range $k, $v := .Config.Labels -}} + {{ $k }}={{ $v }} + {{end -}}' +} + +update_gist() { + ### Updating the secret GitHub gist containing datat (e.g. badge endpoints). + ### 'GIST_TOKEN' secret (PAT) with the 'gist' scope is required + + local gist=${1?Need gist ID} + local gist_key="${2?Need gist key}" + local repo="${3?Need repo}" + local tag="${4?Need repo tag}" + local content="${5?Need content}" + + local data + local envelope + local gist_filename + local result + + if [ -z "${GIST_TOKEN}" ] ; then + echo "Skipping gist update. Required variables not set." + return 0 + fi + + case "${gist_key}" in + "${_gist_key_created}" ) + envelope='{"subject":"created","status":"'${content}'","color":"blue"}' + ;; + "${_gist_key_version_sticker}" ) + envelope='{"subject":"version sticker","status":"'${content}'","color":"blue"}' + ;; + "${_gist_key_version_sticker_verbose}" ) + envelope="${content}" + ;; + * ) + echo "Skipping gist update. Unsupported gist key '${gist_key}'." + return 0 + ;; + esac + + gist_filename=$( make_gist_filename "${repo}" "${tag}" "${gist_key}" ) + + ### encode double-quotes + # envelope="${envelope//\"/\\\"}" + envelope=$( encode_json_quotes "${envelope}" ) + + ### encode new-lines + # envelope=$( echo "${envelope}" | sed -z 's/\n/\\n/g' ) + ### be careful with quotes! + envelope=$( encode_json_newlines "${envelope}" ) + + data='{ "files": { "'${gist_filename}'": { "filename": "'${gist_filename}'", "content": "'${envelope}'" } } }' + + echo "Updating gist '${gist_filename}'" + + ### required 'GIST_TOKEN' (PAT) scope is 'gist' + result=$(curl -s \ + -X PATCH \ + -o /dev/null \ + --write-out "%{http_code}" \ + -H "Authorization: token ${GIST_TOKEN}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/gists/${gist} \ + -d "${data}") + + if [ "${result}" == "200" ] ; then + echo "Gist '${gist_filename}' updated successfully" + echo + return 0 + else + echo "Gist '${gist_filename}' update failed: ${result}" + echo + return 1 + fi +} + +trigger_post_push_workflow() { + ### Trigger the 'post_push' workflow on GitHub. + ### Secret 'POST_PUSH_WORKFLOW_TOKEN' with the scopes 'repo' and 'workflow' is needed. + ### Currently there is no real benefit of triggering this workflow. + + ### example of 'repo' on Docker Hub: 'index.docker.io/accetto/ubuntu-vnc-xfce-g3' + ### 'repo' should be including the owner as 'owner/repo' + local repo="${1?Need repo}" + local tag="${2?Need tag}" + local gist="${3?Need gist}" + local readme_context="${4?Need readme context}" + local branch="${5?Need source branch name}" + local created="${6:-'(not-provided)'}" + local version_sticker="${7:-'(not-provided)'}" + local version_sticker_verbose="${8:-'(not-provided)'}" + local retval_on_failure=${9:-0} + + local data + local result + + ### possibly from environment + local workflow="${POST_PUSH_WORKFLOW:-${_post_push_workflow_file}}" + + if [ -z "${POST_PUSH_WORKFLOW_TOKEN}" ] ; then + echo "Skipping workflow '${workflow}'. Required variables not set." + return ${retval_on_failure} + fi + + ### be careful with quotes! + version_sticker_verbose=$( encode_json_newlines "${version_sticker_verbose}" ) + + data='{ "ref": "'${branch}'", "inputs": { "repo": "'${repo}'", "tag": "'${tag}'", "gist": "'${gist}'", "readme_context": "'${readme_context}'" , "created": "'${created}'", "version_sticker": "'${version_sticker}'", "version_sticker_verbose": "'${version_sticker_verbose}'" } }' + + # echo "About to trigger workflow '${workflow}' passing data:" + # echo "${data}" + + ### required token scopes: repo, workflow + result=$(curl -s \ + -X POST \ + -o /dev/null \ + --write-out "%{http_code}" \ + https://api.github.com/repos/${_owner}/${POST_PUSH_WORKFLOW_REPO}/actions/workflows/"${workflow}"/dispatches \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${POST_PUSH_WORKFLOW_TOKEN}" \ + -d "${data}") + + if [ "${result}" == "204" ] ; then + echo "Workflow '${workflow}' triggered successfuly" + echo + return 0 + else + echo "Workflow '${workflow}' trigger failed: ${result}" + if [ ${retval_on_failure} -eq 0 ] ; then echo "Ignoring the failure." ; fi + echo + return ${retval_on_failure} + fi +} diff --git a/docker/xfce-chromium/README-dockerhub.md b/docker/xfce-chromium/README-dockerhub.md new file mode 100644 index 0000000..03920c9 --- /dev/null +++ b/docker/xfce-chromium/README-dockerhub.md @@ -0,0 +1,124 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC and Chromium Browser + +## accetto/ubuntu-vnc-xfce-chromium-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Full Readme][this-readme-full] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +*** + +**Tip** This is the short README version for Docker Hub. There is also the [full-length README][this-readme-full] on GitHub. + +*** + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment, [VNC][tigervnc]/[noVNC][novnc] servers for headless use and the current [Chromium][chromium] web browser. + +**Remark**: This container contains the current `Chromium Browser` version for `Ubuntu 18.04 LTS`, because the version for `Ubuntu 20.04 LTS` depends on `snap`, which is not working correctly in Docker at this time. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repository [accetto/ubuntu-vnc-xfce-chromium][accetto-github-ubuntu-vnc-xfce-chromium]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +utilities **ping**, **wget**, **sudo** (Ubuntu distribution) + +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) +- current version of [Chromium Browser][chromium] open-source web browser (version for `Ubuntu 18.04 LTS`) + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc` + + ![badge_latest_created][badge_latest_created] + [![badge_latest_version-sticker][badge_latest_version-sticker]][link_latest_version-sticker-verbose] + +- `vnc` implements only VNC + + ![badge_vnc_created][badge_vnc_created] + [![badge_vnc_version-sticker][badge_vnc_version-sticker]][link_vnc_version-sticker-verbose] + +- `vnc-novnc` implements VNC and noVNC + + ![badge_vnc-novnc_created][badge_vnc-novnc_created] + [![badge_vnc-novnc_version-sticker][badge_vnc-novnc_version-sticker]][link_vnc-novnc_version-sticker-verbose] + +Clicking on the version sticker badge reveals more information about the actual configuration of the image. + +### More information + +More information about these images can be found in the [full-length README][this-readme-full] file on GitHub. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-full]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/xfce-chromium/README.md +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-chromium-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce.chromium + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce-chromium/ubuntu-vnc-xfce-chromium.jpg + + + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce-chromium]: https://github.com/accetto/ubuntu-vnc-xfce-chromium + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + +[chromium]: https://www.chromium.org/Home + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-chromium-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-chromium-g3?icon=docker&label=stars + + diff --git a/docker/xfce-chromium/README.md b/docker/xfce-chromium/README.md new file mode 100644 index 0000000..9d1f670 --- /dev/null +++ b/docker/xfce-chromium/README.md @@ -0,0 +1,414 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC and Chromium Browser + +## accetto/ubuntu-vnc-xfce-chromium-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Docker Readme][this-readme-dockerhub] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +- [Headless Ubuntu/Xfce container with VNC/noVNC and Chromium Browser](#headless-ubuntuxfce-container-with-vncnovnc-and-chromium-browser) + - [accetto/ubuntu-vnc-xfce-chromium-g3](#accettoubuntu-vnc-xfce-chromium-g3) + - [Image tags](#image-tags) + - [Ports](#ports) + - [Volumes](#volumes) + - [Version sticker](#version-sticker) + - [Using headless containers](#using-headless-containers) + - [Over VNC](#over-vnc) + - [Over noVNC](#over-novnc) + - [Container user accounts](#container-user-accounts) + - [Running containers in background (detached)](#running-containers-in-background-detached) + - [Running containers in foreground (interactively)](#running-containers-in-foreground-interactively) + - [Startup options and help](#startup-options-and-help) + - [Issues](#issues) + - [Credits](#credits) + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment, [VNC][tigervnc]/[noVNC][novnc] servers for headless use and the current [Chromium][chromium] web browser. + +**Remark**: This container contains the current `Chromium Browser` version for `Ubuntu 18.04 LTS`, because the version for `Ubuntu 20.04 LTS` depends on `snap`, which is not working correctly in Docker at this time. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repository [accetto/ubuntu-vnc-xfce-chromium][accetto-github-ubuntu-vnc-xfce-chromium]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +utilities **ping**, **wget**, **sudo** (Ubuntu distribution) + +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) +- current version of [Chromium Browser][chromium] open-source web browser (version for `Ubuntu 18.04 LTS`) + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc` +- `vnc` implements only VNC +- `vnc-novnc` implements VNC and noVNC + +Clicking on the version sticker badge in the [README on Docker Hub][this-readme-dockerhub] reveals more information about the actual configuration of the image. + +### Ports + +Following **TCP** ports are exposed: + +- **5901** used for access over **VNC** +- **6901** used for access over [noVNC][novnc] + +### Volumes + +The containers do not create or use any external volumes by default. However, the following folders make good mounting points: `/home/headless/Documents/`, `/home/headless/Downloads/`, `/home/headless/Pictures/`, `/home/headless/Public/` + +Both **named volumes** and **bind mounts** can be used. More about volumes can be found in the [Docker documentation][docker-doc] (e.g. [Manage data in Docker][docker-doc-managing-data]). + +### Version sticker + +Version sticker serves multiple purposes that are closer described in [Wiki][this-wiki]. Note that the usage of the version sticker has changed between the generations of images. + +The **short version sticker value** identifies the version of the docker image and it is persisted in its *label* when the image is built. It is also shown as a badge in the README file. + +The **verbose version sticker value** is used by the CI builder to decide if the image needs to be refreshed. It describes the actual configuration of essential components of the image. It can be revealed by clicking on the version sticker badge in the README file. + +The version sticker values are generated by the script `version_sticker.sh`, which is deployed into the startup directory `/dockerstartup`. The script will show a short help if executed with the argument `-h`. There is also a convenient `Version Sticker` launcher on the container desktop. + +## Using headless containers + +There are two ways, how to use the created headless containers. + +The default **VNC user** password is **headless** and it can be changed through the environment variable **VNC_PW**. For example the following container would use the password value **mynewpwd**: + +```shell +docker run -d -P -e VNC_PW=mynewpwd accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +The argument `-P` means that the **VNC** and **noVNC** ports exposed by the container will be bound to the next free TCP ports on the host. It is also possible to bind them explicitly. For example: + +```shell +docker run -d -p 25901:5901 -p 26901:6901 accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +In this case, if the host is named `mynas`, then **VNC** is accessible as `mynas:25091` and **noVNC** as `mynas:26901`. + +### Over VNC + +To be able to use the containers over **VNC**, some **VNC Viewer** is needed (e.g. [TigerVNC][tigervnc] or [TightVNC][tightvnc]). + +The VNC Viewer should connect to the host running the container, pointing to its TCP port mapped to the container's TCP port **5901**. + +For example, if the container has been created on the host called `mynas` using the parameters described above, the VNC Viewer should connect to `mynas:25901`. + +### Over noVNC + +To be able to use the containers over [noVNC][novnc], an HTML5 capable web browser is needed. It actually means, that any current web browser can be used. + +The browser should navigate to the host running the container, pointing to its TCP port mapped to the container's TCP port **6901**. + +The containers offer two [noVNC][novnc] clients - the **lite** client and the **full** client with more features. The connection URL differs slightly in both cases. To make it easier, a **simple startup page** is implemented. + +For example, if the container has been created on the host called `mynas` using the parameters described above, then the web browser should navigate to `http://mynas:26901`. + +The startup page will show two hyperlinks pointing to the both noVNC clients: + +- `http://mynas:26901/vnc_lite.html` +- `http://mynas:26901/vnc.html` + +It's also possible to provide the password through the links: + +- `http://mynas:26901/vnc_lite.html?password=headless` +- `http://mynas:26901/vnc.html?password=headless` + +## Container user accounts + +Containers created from this image run under the **default application user** (headless, 1001:0) with the default password set also to **headless**. This password can be changed inside the container using the following command: + +```shell +passwd +``` + +Please do not confuse the **default application user** password with the **VNC user** password, because they both have the same default value. However, the former one is used for **sudo** and it can be changed using `passwd` command. The latter one is used for VNC access and it can be changed through the **VNC_PW** environment variable (see above). + +The **sudo** command allows user elevation, so the **default application user** can, for example, install new applications. + +The following example shows how to install **git**: + +```shell +sudo apt-get update +sudo apt-get install -y git +``` + +Note that the default application account's **group membership** (group zero) does not give it automatically the privileges of the **root** user. Technical details will be described in [Wiki][this-wiki]. + +The container user ID (1001 by default) can be changed by creating the container using the `--user` parameter, for example: + +```shell +docker run -it -P --rm --user 2019 accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +**Remark**: The following feature is available also for this image, but those specific image tags (`fugo`) are currently not built by default. However, you can enable the feature `FEATURES_USER_GROUP_OVERRIDE` in the hook scripts and build them yourself. + +The image supports also overriding the container user's group ID (0 by default). However, the image must be built with the argument `ARG_SUPPORT_USER_GROUP_OVERRIDE`. Otherwise the following command line would fail: + +```shell +### This will fail (Permission denied) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc + +### This will work (image built with ARG_SUPPORT_USER_GROUP_OVERRIDE) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc-fugo +``` + +The images having the tag suffix `-fugo` (**f**eatures **u**ser **g**roup **o**verride) are built just that way. + +Note that only numerical ID and GID are supported. Technical details will be described in [Wiki][this-wiki]. + +## Running containers in background (detached) + +The following container will keep running in the background and it will listen on an automatically selected TCP port on the host computer: + +```shell +docker run -dP accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +The following container will listen on the host's TCP port **25901**: + +```shell +docker run -d -p 25901:5901 accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +The following container will create (or re-use) the local named volume **my\_Downloads** mounted as `/home/headless/Downloads`: + +```shell +docker run -d -P -v my_Downloads:/home/headless/Downloads accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +or using the newer syntax with **--mount** flag: + +```shell +docker run -d -P --mount source=my_Downloads,target=/home/headless/Downloads accetto/ubuntu-vnc-xfce-chromium-g3 +``` + +## Running containers in foreground (interactively) + +The following container can be used interactively: + +```shell +docker run -it --rm accetto/ubuntu-vnc-xfce-chromium-g3 bash +``` + +The opened `bash` session can be used as usual and then closed by entering `^C` (CTRL-C): + +```shell +To run a command as administrator (user "root"), use "sudo ". +See "man sudo_root" for details. + +headless@cf4a4e01d94b:~$ whoami +headless +headless@cf4a4e01d94b:~$ pwd +/home/headless +headless@cf4a4e01d94b:~$ +``` + +The container will remove itself. + +## Startup options and help + +The image supports multiple **start-up options** and **start-up modifiers**. There also also two help modes. + +The following container will print out the short help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-chromium-g3 --help +``` + +Example of the short help text: + +```text +Container startup script +Usage: /dockerstartup/startup.sh [-v|--version] [-h|--help] [-H|--help-usage] [--(no-)wait] [--(no-)skip-startup] [--(no-)tail-null] [--(no-)tail-vnc] [--(no-)version-sticker] [--(no-)version-sticker-verbose] [--(no-)skip-vnc] [--(no-)skip-novnc] [--(no-)debug] [--(no-)verbose] [--] [] ... [] ... + : Optional command with optional arguments. It is executed during startup. + -v, --version: Prints version + -h, --help: Prints help + -H, --help-usage: Extended container usage help. + --wait, --no-wait: Default background execution mode (on by default) + --skip-startup, --no-skip-startup: Default foreground execution mode (off by default) + --tail-null, --no-tail-null: Alternative background execution mode (off by default) + --tail-vnc, --no-tail-vnc: Alternative background execution mode (off by default) + --version-sticker, --no-version-sticker: Alternative foreground execution mode (off by default) + --version-sticker-verbose, --no-version-sticker-verbose: Alternative foreground execution mode (off by default) + --skip-vnc, --no-skip-vnc: Startup process modifier (off by default) + --skip-novnc, --no-skip-novnc: Startup process modifier (off by default) + --debug, --no-debug: Startup process modifier (off by default) + --verbose, --no-verbose: Startup process modifier (off by default) + +Use '-H' or '--help-usage' for extended container usage help. +For more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +The following container will print out the long help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-chromium-g3 --help-usage +``` + +Example of the long help text: + +```text +CONTAINER USAGE: +docker run [] accetto/: [] [] + +POSITIONAL ARGUMENTS: +command + Optional command with optional arguments. + It will be executed during startup before going waiting, tailing or asleep. + It is necessary to use the quotes correctly or the 'bash -c ""' pattern. + +STARTUP OPTIONS: + +--wait, or no options, or unknown option, or empty input + Default background execution mode. + Starts the VNC and noVNC servers, if available, then executes the command + and waits until the VNC server process exits or goes asleep infinitely. + Container keeps running in the background. + +--skip-startup + Default foreground execution mode. + Skips the startup procedure, executes the command and exits. + Be aware that the container user generator will be also skipped. + Container does not keep running in the background. + +--tail-null + Alternative background execution mode. + Similar to '--wait', but tails the null device instead of going asleep. + Container keeps running in the background. + +--tail-vnc + Alternative background execution mode. + Similar to '--wait', but tails the VNC log instead of waiting until the VNC process exits. + Falls back to '--tail-null' if the VNC server has not been started. + Container keeps running in the background. + +--version-sticker + Alternative foreground execution mode. + Prints out the version sticker info. + The VNC server is also started by default, if available, because some applications + need a display to report their versions correctly. It can be suppressed by providing + also '--skip-vnc'. The '--skip-novnc' option is always enforced automatically. + Container does not keep running in the background. + +--version-sticker-verbose + Alternative foreground execution mode. + Similar to '--version-sticker', but prints out the verbose version sticker info and features list. + Container does not keep running in the background. + +--skip-vnc + Startup process modifier. + If VNC and noVNC startup should be skipped. + It also enforces '--skip-novnc'. + +--skip-novnc + Startup process modifier. + If noVNC startup should be skipped. + It is also enforced by '--skip-vnc'. + +--debug + Startup process modifier. + If additional debugging info should be displayed during startup. + It also enforces option '--verbose'. + +--verbose + Startup process modifier. + If startup progress messages should be displayed. + It is also enforced by '--debug'. + +--help-usage, -H + Prints out this extended container usage help and exits. + The rest of the input is ignored. + +--help, -h + Prints out the short startup script help and exits. + The rest of the input is ignored. + +--version, -v + Prints out the version of the startup script and exits. + The rest of the input is ignored. + +Use '-h' or '--help' for short startup script help. +Fore more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +## Issues + +If you have found a problem or you just have a question, please check the [Issues][this-issues] and the [Wiki][this-wiki] first. Please do not overlook the closed issues. + +If you do not find a solution, you can file a new issue. The better you describe the problem, the bigger the chance it'll be solved soon. + +## Credits + +Credit goes to all the countless people and companies, who contribute to open source community and make so many dreamy things real. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-dockerhub]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-chromium-g3 +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-chromium-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce.chromium + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce-chromium/ubuntu-vnc-xfce-chromium.jpg + + + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce-chromium]: https://github.com/accetto/ubuntu-vnc-xfce-chromium + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + +[chromium]: https://www.chromium.org/Home + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-chromium-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-chromium-g3?icon=docker&label=stars diff --git a/docker/xfce-chromium/readme-append.template b/docker/xfce-chromium/readme-append.template new file mode 100644 index 0000000..dcb8d8a --- /dev/null +++ b/docker/xfce-chromium/readme-append.template @@ -0,0 +1,26 @@ + + + + + +[badge_latest_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@created.json + +[badge_latest_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker.json + +[link_latest_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker-verbose.txt + + + +[badge_vnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@created.json + +[badge_vnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker.json + +[link_vnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker-verbose.txt + + + +[badge_vnc-novnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@created.json + +[badge_vnc-novnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker.json + +[link_vnc-novnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker-verbose.txt diff --git a/docker/xfce-chromium/src/home/Desktop/chromium-browser.desktop b/docker/xfce-chromium/src/home/Desktop/chromium-browser.desktop new file mode 100644 index 0000000..2ddea7b --- /dev/null +++ b/docker/xfce-chromium/src/home/Desktop/chromium-browser.desktop @@ -0,0 +1,295 @@ +[Desktop Entry] +Version=1.0 +Name=Chromium Web Browser +Name[ast]=Restolador web Chromium +Name[bg]=Уеб четец Chromium +Name[bn]=ক্রোমিয়াম ওয়েব ব্রাউজার +Name[bs]=Chromium web preglednik +Name[ca]=Navegador web Chromium +Name[ca@valencia]=Navegador web Chromium +Name[da]=Chromium netbrowser +Name[de]=Chromium-Webbrowser +Name[en_AU]=Chromium Web Browser +Name[eo]=Kromiumo retfoliumilo +Name[es]=Navegador web Chromium +Name[et]=Chromiumi veebibrauser +Name[eu]=Chromium web-nabigatzailea +Name[fi]=Chromium-selain +Name[fr]=Navigateur Web Chromium +Name[gl]=Navegador web Chromium +Name[he]=דפדפן האינטרנט כרומיום +Name[hr]=Chromium web preglednik +Name[hu]=Chromium webböngésző +Name[hy]=Chromium ոստայն զննարկիչ +Name[ia]=Navigator del web Chromium +Name[id]=Peramban Web Chromium +Name[it]=Browser web Chromium +Name[ja]=Chromium ウェブ・ブラウザ +Name[ka]=ვებ ბრაუზერი Chromium +Name[ko]=Chromium 웹 브라우저 +Name[kw]=Peurel wias Chromium +Name[ms]=Pelayar Web Chromium +Name[nb]=Chromium nettleser +Name[nl]=Chromium webbrowser +Name[pt_BR]=Navegador de Internet Chromium +Name[ro]=Navigator Internet Chromium +Name[ru]=Веб-браузер Chromium +Name[sl]=Chromium spletni brskalnik +Name[sv]=Webbläsaren Chromium +Name[ug]=Chromium توركۆرگۈ +Name[vi]=Trình duyệt Web Chromium +Name[zh_CN]=Chromium 网页浏览器 +Name[zh_HK]=Chromium 網頁瀏覽器 +Name[zh_TW]=Chromium 網頁瀏覽器 +GenericName=Web Browser +GenericName[ar]=متصفح الشبكة +GenericName[ast]=Restolador web +GenericName[bg]=Уеб браузър +GenericName[bn]=ওয়েব ব্রাউজার +GenericName[bs]=Web preglednik +GenericName[ca]=Navegador web +GenericName[ca@valencia]=Navegador web +GenericName[cs]=WWW prohlížeč +GenericName[da]=Browser +GenericName[de]=Web-Browser +GenericName[el]=Περιηγητής ιστού +GenericName[en_AU]=Web Browser +GenericName[en_GB]=Web Browser +GenericName[eo]=Retfoliumilo +GenericName[es]=Navegador web +GenericName[et]=Veebibrauser +GenericName[eu]=Web-nabigatzailea +GenericName[fi]=WWW-selain +GenericName[fil]=Web Browser +GenericName[fr]=Navigateur Web +GenericName[gl]=Navegador web +GenericName[gu]=વેબ બ્રાઉઝર +GenericName[he]=דפדפן אינטרנט +GenericName[hi]=वेब ब्राउज़र +GenericName[hr]=Web preglednik +GenericName[hu]=Webböngésző +GenericName[hy]=Ոստայն զննարկիչ +GenericName[ia]=Navigator del Web +GenericName[id]=Peramban Web +GenericName[it]=Browser web +GenericName[ja]=ウェブ・ブラウザ +GenericName[ka]=ვებ ბრაუზერი +GenericName[kn]=ಜಾಲ ವೀಕ್ಷಕ +GenericName[ko]=웹 브라우저 +GenericName[kw]=Peurel wias +GenericName[lt]=Žiniatinklio naršyklė +GenericName[lv]=Tīmekļa pārlūks +GenericName[ml]=വെബ് ബ്രൌസര്‍ +GenericName[mr]=वेब ब्राऊजर +GenericName[ms]=Pelayar Web +GenericName[nb]=Nettleser +GenericName[nl]=Webbrowser +GenericName[or]=ଓ୍ବେବ ବ୍ରାଉଜର +GenericName[pl]=Przeglądarka WWW +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador web +GenericName[ro]=Navigator de Internet +GenericName[ru]=Веб-браузер +GenericName[sk]=WWW prehliadač +GenericName[sl]=Spletni brskalnik +GenericName[sr]=Интернет прегледник +GenericName[sv]=Webbläsare +GenericName[ta]=இணைய உலாவி +GenericName[te]=మహాతల అన్వేషి +GenericName[th]=เว็บเบราว์เซอร์ +GenericName[tr]=Web Tarayıcı +GenericName[ug]=توركۆرگۈ +GenericName[uk]=Навігатор Тенет +GenericName[vi]=Bộ duyệt Web +GenericName[zh_CN]=网页浏览器 +GenericName[zh_HK]=網頁瀏覽器 +GenericName[zh_TW]=網頁瀏覽器 +Comment=Access the Internet +Comment[ar]=الدخول إلى الإنترنت +Comment[ast]=Accesu a Internet +Comment[bg]=Достъп до интернет +Comment[bn]=ইন্টারনেটে প্রবেশ করুন +Comment[bs]=Pristup internetu +Comment[ca]=Accediu a Internet +Comment[ca@valencia]=Accediu a Internet +Comment[cs]=Přístup k internetu +Comment[da]=Få adgang til internettet +Comment[de]=Internetzugriff +Comment[el]=Πρόσβαση στο Διαδίκτυο +Comment[en_AU]=Access the Internet +Comment[en_GB]=Access the Internet +Comment[eo]=Akiri interreton +Comment[es]=Acceda a Internet +Comment[et]=Pääs Internetti +Comment[eu]=Sartu Internetera +Comment[fi]=Käytä internetiä +Comment[fil]=I-access ang Internet +Comment[fr]=Accéder à Internet +Comment[gl]=Acceda a Internet +Comment[gu]=ઇંટરનેટ ઍક્સેસ કરો +Comment[he]=גישה לאינטרנט +Comment[hi]=इंटरनेट तक पहुंच स्थापित करें +Comment[hr]=Pristupite Internetu +Comment[hu]=Az internet elérése +Comment[hy]=Մուտք համացանց +Comment[ia]=Accede a le Interrete +Comment[id]=Akses Internet +Comment[it]=Accesso a Internet +Comment[ja]=インターネットにアクセス +Comment[ka]=ინტერნეტში შესვლა +Comment[kn]=ಇಂಟರ್ನೆಟ್ ಅನ್ನು ಪ್ರವೇಶಿಸಿ +Comment[ko]=인터넷에 연결합니다 +Comment[kw]=Hedhes an Kesrosweyth +Comment[lt]=Interneto prieiga +Comment[lv]=Piekļūt internetam +Comment[ml]=ഇന്റര്‍‌നെറ്റ് ആക്‌സസ് ചെയ്യുക +Comment[mr]=इंटरनेटमध्ये प्रवेश करा +Comment[ms]=Mengakses Internet +Comment[nb]=Bruk internett +Comment[nl]=Verbinding maken met internet +Comment[or]=ଇଣ୍ଟର୍ନେଟ୍ ପ୍ରବେଶ କରନ୍ତୁ +Comment[pl]=Skorzystaj z internetu +Comment[pt]=Aceder à Internet +Comment[pt_BR]=Acessar a internet +Comment[ro]=Accesați Internetul +Comment[ru]=Доступ в Интернет +Comment[sk]=Prístup do siete Internet +Comment[sl]=Dostop do interneta +Comment[sr]=Приступите Интернету +Comment[sv]=Surfa på Internet +Comment[ta]=இணையத்தை அணுகுதல் +Comment[te]=ఇంటర్నెట్‌ను ఆక్సెస్ చెయ్యండి +Comment[th]=เข้าถึงอินเทอร์เน็ต +Comment[tr]=İnternet'e erişin +Comment[ug]=ئىنتېرنېت زىيارىتى +Comment[uk]=Доступ до Інтернету +Comment[vi]=Truy cập Internet +Comment[zh_CN]=访问互联网 +Comment[zh_HK]=連線到網際網路 +Comment[zh_TW]=連線到網際網路 +Exec=chromium-browser %U +Terminal=false +X-MultipleArgs=false +Type=Application +Icon=chromium-browser +Categories=Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +Actions=NewWindow;Incognito;TempProfile; +X-AppInstall-Package=chromium-browser + +[Desktop Action NewWindow] +Name=Open a New Window +Name[ast]=Abrir una Ventana Nueva +Name[bg]=Отваряне на Нов прозорец +Name[bn]=একটি নতুন উইন্ডো খুলুন +Name[bs]=Otvori novi prozor +Name[ca]=Obre una finestra nova +Name[ca@valencia]=Obri una finestra nova +Name[da]=Åbn et nyt vindue +Name[de]=Ein neues Fenster öffnen +Name[en_AU]=Open a New Window +Name[eo]=Malfermi novan fenestron +Name[es]=Abrir una ventana nueva +Name[et]=Ava uus aken +Name[eu]=Ireki leiho berria +Name[fi]=Avaa uusi ikkuna +Name[fr]=Ouvrir une nouvelle fenêtre +Name[gl]=Abrir unha nova xanela +Name[he]=פתיחת חלון חדש +Name[hy]=Բացել նոր պատուհան +Name[ia]=Aperi un nove fenestra +Name[it]=Apri una nuova finestra +Name[ja]=新しいウィンドウを開く +Name[ka]=ახალი ფანჯრის გახსნა +Name[kw]=Egery fenester noweth +Name[ms]=Buka Tetingkap Baru +Name[nb]=Åpne et nytt vindu +Name[nl]=Nieuw venster openen +Name[pt_BR]=Abre uma nova janela +Name[ro]=Deschide o fereastră nouă +Name[ru]=Открыть новое окно +Name[sl]=Odpri novo okno +Name[sv]=Öppna ett nytt fönster +Name[ug]=يېڭى كۆزنەك ئاچ +Name[uk]=Відкрити нове вікно +Name[vi]=Mở cửa sổ mới +Name[zh_CN]=打开新窗口 +Name[zh_TW]=開啟新視窗 +Exec=chromium-browser + +[Desktop Action Incognito] +Name=Open a New Window in incognito mode +Name[ast]=Abrir una ventana nueva en mou incógnitu +Name[bg]=Отваряне на нов прозорец в режим \"инкогнито\" +Name[bn]=একটি নতুন উইন্ডো খুলুন ইনকোগনিটো অবস্থায় +Name[bs]=Otvori novi prozor u privatnom modu +Name[ca]=Obre una finestra nova en mode d'incògnit +Name[ca@valencia]=Obri una finestra nova en mode d'incògnit +Name[de]=Ein neues Fenster im Inkognito-Modus öffnen +Name[en_AU]=Open a New Window in incognito mode +Name[eo]=Malfermi novan fenestron nekoniĝeble +Name[es]=Abrir una ventana nueva en modo incógnito +Name[et]=Ava uus aken tundmatus olekus +Name[eu]=Ireki leiho berria isileko moduan +Name[fi]=Avaa uusi ikkuna incognito-tilassa +Name[fr]=Ouvrir une nouvelle fenêtre en mode navigation privée +Name[gl]=Abrir unha nova xanela en modo de incógnito +Name[he]=פתיחת חלון חדש במצב גלישה בסתר +Name[hy]=Բացել նոր պատուհան ծպտյալ աշխատակերպում +Name[ia]=Aperi un nove fenestra in modo incognite +Name[it]=Apri una nuova finestra in modalità incognito +Name[ja]=新しいシークレット ウィンドウを開く +Name[ka]=ახალი ფანჯრის ინკოგნიტოდ გახსნა +Name[kw]=Egry fenester noweth en modh privedh +Name[ms]=Buka Tetingkap Baru dalam mod menyamar +Name[nl]=Nieuw venster openen in incognito-modus +Name[pt_BR]=Abrir uma nova janela em modo anônimo +Name[ro]=Deschide o fereastră nouă în mod incognito +Name[ru]=Открыть новое окно в режиме инкогнито +Name[sl]=Odpri novo okno v načinu brez beleženja +Name[sv]=Öppna ett nytt inkognitofönster +Name[ug]=يوشۇرۇن ھالەتتە يېڭى كۆزنەك ئاچ +Name[uk]=Відкрити нове вікно у приватному режимі +Name[vi]=Mở cửa sổ mới trong chế độ ẩn danh +Name[zh_CN]=以隐身模式打开新窗口 +Name[zh_TW]=以匿名模式開啟新視窗 +Exec=chromium-browser --incognito + +[Desktop Action TempProfile] +Name=Open a New Window with a temporary profile +Name[ast]=Abrir una ventana nueva con perfil temporal +Name[bg]=Отваряне на Нов прозорец с временен профил +Name[bn]=সাময়িক প্রোফাইল সহ একটি নতুন উইন্ডো খুলুন +Name[bs]=Otvori novi prozor pomoću privremenog profila +Name[ca]=Obre una finestra nova amb un perfil temporal +Name[ca@valencia]=Obri una finestra nova amb un perfil temporal +Name[de]=Ein neues Fenster mit einem temporären Profil öffnen +Name[en_AU]=Open a New Window with a temporary profile +Name[eo]=Malfermi novan fenestron portempe +Name[es]=Abrir una ventana nueva con perfil temporal +Name[et]=Ava uus aken ajutise profiiliga +Name[eu]=Ireki leiho berria behin-behineko profil batekin +Name[fi]=Avaa uusi ikkuna käyttäen väliaikaista profiilia +Name[fr]=Ouvrir une nouvelle fenêtre avec un profil temporaire +Name[gl]=Abrir unha nova xanela con perfil temporal +Name[he]=פתיחת חלון חדש עם פרופיל זמני +Name[hy]=Բացել նոր պատուհան ժամանակավոր հատկագրով +Name[ia]=Aperi un nove fenestra con un profilo provisori +Name[it]=Apri una nuova finestra con un profilo temporaneo +Name[ja]=一時プロファイルで新しいウィンドウを開く +Name[ka]=ახალი ფანჯრის გახსნა დროებით პროფილში +Name[kw]=Egery fenester noweth gen profil dres prys +Name[ms]=Buka Tetingkap Baru dengan profil sementara +Name[nb]=Åpne et nytt vindu med en midlertidig profil +Name[nl]=Nieuw venster openen met een tijdelijk profiel +Name[pt_BR]=Abrir uma nova janela com um perfil temporário +Name[ro]=Deschide o fereastră nouă cu un profil temporar +Name[ru]=Открыть новое окно с временным профилем +Name[sl]=Odpri novo okno z začasnim profilom +Name[sv]=Öppna ett nytt fönster med temporär profil +Name[ug]=ۋاقىتلىق سەپلىمە ھۆججەت بىلەن يېڭى كۆزنەك ئاچ +Name[vi]=Mở cửa sổ mới với hồ sơ tạm +Name[zh_CN]=以临时配置文件打开新窗口 +Name[zh_TW]=以暫時性個人身分開啟新視窗 +Exec=chromium-browser --temp-profile diff --git a/docker/xfce-chromium/src/startup/version_sticker.sh b/docker/xfce-chromium/src/startup/version_sticker.sh new file mode 100644 index 0000000..627741f --- /dev/null +++ b/docker/xfce-chromium/src/startup/version_sticker.sh @@ -0,0 +1,62 @@ +#!/bin/bash +### @accetto, September 2019 + +### resolve also symlinks +_current_dir="$(dirname "$(readlink -f "$0")")" + +ubuntu=$("${_current_dir}/version_of.sh" ubuntu) +chromium=$("${STARTUPDIR}/version_of.sh" chromium) + +main() { + local key + + if [ $# -gt 0 ] ; then + while [ $# -gt 0 ] ; do + key="$1" + if [ "${key}" = '--' ] ; then shift ; fi + case "${key}" in + -h ) + echo "Usage: version_sticker [-h] [-v] [-V] [-f]" + echo "-h help" + echo "-v short version sticker" + echo "-V verbose version sticker" + echo "-f features" + ;; + -v ) + echo "Ubuntu ${ubuntu}" + echo "Chromium ${chromium}" + ;; + -V ) + echo "Ubuntu ${ubuntu}" + version=$("${_current_dir}/version_of.sh" nano) + if [ -n "${version}" ] ; then echo "nano ${version}" ; fi + version=$("${_current_dir}/version_of.sh" jq) + if [ -n "${version}" ] ; then echo "jq ${version}" ; fi + version=$("${_current_dir}/version_of.sh" mousepad) + if [ -n "${version}" ] ; then echo "Mousepad ${version}" ; fi + version=$("${_current_dir}/version_of.sh" tigervnc) + if [ -n "${version}" ] ; then echo "TigerVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" screenshooter) + if [ -n "${version}" ] ; then echo "xfce4-screenshooter ${version}" ; fi + version=$("${_current_dir}/version_of.sh" ristretto) + if [ -n "${version}" ] ; then echo "Ristretto ${version}" ; fi + version=$("${_current_dir}/version_of.sh" novnc) + if [ -n "${version}" ] ; then echo "noVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" websockify) + if [ -n "${version}" ] ; then echo "websockify ${version}" ; fi + echo "Chromium ${chromium}" + ;; + -f ) + env | grep "FEATURES_" | sort + ;; + esac + shift + done + else + ### example: ubuntu20.04.1-chromium76.0.3809.100 + sticker="ubuntu${ubuntu}"-"chromium${chromium}" + echo "${sticker}" + fi +} + +main $@ diff --git a/docker/xfce-chromium/ubuntu-vnc-xfce-chromium.jpg b/docker/xfce-chromium/ubuntu-vnc-xfce-chromium.jpg new file mode 100644 index 0000000..2bdbe13 Binary files /dev/null and b/docker/xfce-chromium/ubuntu-vnc-xfce-chromium.jpg differ diff --git a/docker/xfce-firefox/README-dockerhub.md b/docker/xfce-firefox/README-dockerhub.md new file mode 100644 index 0000000..4bbf351 --- /dev/null +++ b/docker/xfce-firefox/README-dockerhub.md @@ -0,0 +1,142 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC and Firefox Browser + +## accetto/ubuntu-vnc-xfce-firefox-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Full Readme][this-readme-full] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +*** + +**Tip** This is the short README version for Docker Hub. There is also the [full-length README][this-readme-full] on GitHub. + +**Warning** about images with Firefox + +There is no single-process Firefox image in this repository and the multi-process mode is always enabled. Be aware, that multi-process requires larger shared memory (`/dev/shm`). At least 256MB is recommended. Please check the **Firefox multi-process** page in [this Wiki][that-wiki-firefox-multiprocess] for more information and the instructions, how to set the shared memory size in different scenarios. + +*** + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment, [VNC][tigervnc]/[noVNC][novnc] servers for headless use and the current [Firefox Quantum][firefox] web browser. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repositories [accetto/ubuntu-vnc-xfce-firefox][accetto-github-ubuntu-vnc-xfce-firefox] and [accetto/ubuntu-vnc-xfce-firefox-plus][accetto-github-ubuntu-vnc-xfce-firefox-plus]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +utilities **ping**, **wget**, **sudo** (Ubuntu distribution) + +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) +- current version of [Firefox Quantum][firefox] web browser and some additional **plus** features described below + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc-plus` + + ![badge_latest_created][badge_latest_created] + [![badge_latest_version-sticker][badge_latest_version-sticker]][link_latest_version-sticker-verbose] + +- `vnc` implements only VNC + + ![badge_vnc_created][badge_vnc_created] + [![badge_vnc_version-sticker][badge_vnc_version-sticker]][link_vnc_version-sticker-verbose] + +- `vnc-novnc` implements VNC and noVNC + + ![badge_vnc-novnc_created][badge_vnc-novnc_created] + [![badge_vnc-novnc_version-sticker][badge_vnc-novnc_version-sticker]][link_vnc-novnc_version-sticker-verbose] + +- `vnc-plus` implements only VNC and Firefox plus features + + ![badge_vnc-plus_created][badge_vnc-plus_created] + [![badge_vnc-plus_version-sticker][badge_vnc-plus_version-sticker]][link_vnc-plus_version-sticker-verbose] + +- `vnc-novnc-plus` implements VNC, noVNC and Firefox plus features + + ![badge_vnc-novnc-plus_created][badge_vnc-novnc-plus_created] + [![badge_vnc-novnc-plus_version-sticker][badge_vnc-novnc-plus_version-sticker]][link_vnc-novnc-plus_version-sticker-verbose] + +Clicking on the version sticker badge reveals more information about the actual configuration of the image. + +### More information + +More information about these images can be found in the [full-length README][this-readme-full] file on GitHub. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-full]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/xfce-firefox/README.md +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + +[that-readme-startup-help]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/xfce/README-dockerhub.md#startup-options-and-help + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-firefox-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce.firefox + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce-firefox/ubuntu-vnc-xfce-firefox-plus.jpg + + + +[that-wiki-firefox-multiprocess]: https://github.com/accetto/xubuntu-vnc/wiki/Firefox-multiprocess + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce-firefox]: https://github.com/accetto/ubuntu-vnc-xfce-firefox +[accetto-github-ubuntu-vnc-xfce-firefox-plus]: https://github.com/accetto/ubuntu-vnc-xfce-firefox-plus + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + +[firefox]: https://www.mozilla.org +[firefox-doc-preferences]: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-firefox-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-firefox-g3?icon=docker&label=stars + + diff --git a/docker/xfce-firefox/README.md b/docker/xfce-firefox/README.md new file mode 100644 index 0000000..fa04360 --- /dev/null +++ b/docker/xfce-firefox/README.md @@ -0,0 +1,487 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC and Firefox Browser + +## accetto/ubuntu-vnc-xfce-firefox-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Docker Readme][this-readme-dockerhub] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +- [Headless Ubuntu/Xfce container with VNC/noVNC and Firefox Browser](#headless-ubuntuxfce-container-with-vncnovnc-and-firefox-browser) + - [accetto/ubuntu-vnc-xfce-firefox-g3](#accettoubuntu-vnc-xfce-firefox-g3) + - [Image tags](#image-tags) + - [Ports](#ports) + - [Volumes](#volumes) + - [Version sticker](#version-sticker) + - [Using headless containers](#using-headless-containers) + - [Over VNC](#over-vnc) + - [Over noVNC](#over-novnc) + - [Container user accounts](#container-user-accounts) + - [Running containers in background (detached)](#running-containers-in-background-detached) + - [Running containers in foreground (interactively)](#running-containers-in-foreground-interactively) + - [Firefox multi-process](#firefox-multi-process) + - [Setting shared memory size](#setting-shared-memory-size) + - [Firefox preferences and the plus features](#firefox-preferences-and-the-plus-features) + - [Startup options and help](#startup-options-and-help) + - [Issues](#issues) + - [Credits](#credits) + +*** + +**Warning** about images with Firefox + +There is no single-process Firefox image in this repository and the multi-process mode is always enabled. Be aware, that multi-process requires larger shared memory (`/dev/shm`). At least 256MB is recommended. Please check the **Firefox multi-process** page in [this Wiki][that-wiki-firefox-multiprocess] for more information and the instructions, how to set the shared memory size in different scenarios. + +*** + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment, [VNC][tigervnc]/[noVNC][novnc] servers for headless use and the current [Firefox Quantum][firefox] web browser. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repositories [accetto/ubuntu-vnc-xfce-firefox][accetto-github-ubuntu-vnc-xfce-firefox] and [accetto/ubuntu-vnc-xfce-firefox-plus][accetto-github-ubuntu-vnc-xfce-firefox-plus]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +utilities **ping**, **wget**, **sudo** (Ubuntu distribution) + +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) +- current version of [Firefox Quantum][firefox] web browser and some additional **plus** features described below + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc-plus` +- `vnc` implements only VNC +- `vnc-novnc` implements VNC and noVNC +- `vnc-plus` implements only VNC and Firefox plus features +- `vnc-novnc-plus` implements VNC, noVNC and Firefox plus features + +Clicking on the version sticker badge in the [README on Docker Hub][this-readme-dockerhub] reveals more information about the actual configuration of the image. + +### Ports + +Following **TCP** ports are exposed: + +- **5901** used for access over **VNC** +- **6901** used for access over [noVNC][novnc] + +### Volumes + +The containers do not create or use any external volumes by default. However, the following folders make good mounting points: `/home/headless/Documents/`, `/home/headless/Downloads/`, `/home/headless/Pictures/`, `/home/headless/Public/` + +Both **named volumes** and **bind mounts** can be used. More about volumes can be found in the [Docker documentation][docker-doc] (e.g. [Manage data in Docker][docker-doc-managing-data]). + +### Version sticker + +Version sticker serves multiple purposes that are closer described in [Wiki][this-wiki]. Note that the usage of the version sticker has changed between the generations of images. + +The **short version sticker value** identifies the version of the docker image and it is persisted in its *label* when the image is built. It is also shown as a badge in the README file. + +The **verbose version sticker value** is used by the CI builder to decide if the image needs to be refreshed. It describes the actual configuration of essential components of the image. It can be revealed by clicking on the version sticker badge in the README file. + +The version sticker values are generated by the script `version_sticker.sh`, which is deployed into the startup directory `/dockerstartup`. The script will show a short help if executed with the argument `-h`. There is also a convenient `Version Sticker` launcher on the container desktop. + +## Using headless containers + +There are two ways, how to use the created headless containers. + +The default **VNC user** password is **headless** and it can be changed through the environment variable **VNC_PW**. For example the following container would use the password value **mynewpwd**: + +```shell +docker run -d -P -e VNC_PW=mynewpwd accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +The argument `-P` means that the **VNC** and **noVNC** ports exposed by the container will be bound to the next free TCP ports on the host. It is also possible to bind them explicitly. For example: + +```shell +docker run -d -p 25901:5901 -p 26901:6901 accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +In this case, if the host is named `mynas`, then **VNC** is accessible as `mynas:25091` and **noVNC** as `mynas:26901`. + +### Over VNC + +To be able to use the containers over **VNC**, some **VNC Viewer** is needed (e.g. [TigerVNC][tigervnc] or [TightVNC][tightvnc]). + +The VNC Viewer should connect to the host running the container, pointing to its TCP port mapped to the container's TCP port **5901**. + +For example, if the container has been created on the host called `mynas` using the parameters described above, the VNC Viewer should connect to `mynas:25901`. + +### Over noVNC + +To be able to use the containers over [noVNC][novnc], an HTML5 capable web browser is needed. It actually means, that any current web browser can be used. + +The browser should navigate to the host running the container, pointing to its TCP port mapped to the container's TCP port **6901**. + +The containers offer two [noVNC][novnc] clients - the **lite** client and the **full** client with more features. The connection URL differs slightly in both cases. To make it easier, a **simple startup page** is implemented. + +For example, if the container has been created on the host called `mynas` using the parameters described above, then the web browser should navigate to `http://mynas:26901`. + +The startup page will show two hyperlinks pointing to the both noVNC clients: + +- `http://mynas:26901/vnc_lite.html` +- `http://mynas:26901/vnc.html` + +It's also possible to provide the password through the links: + +- `http://mynas:26901/vnc_lite.html?password=headless` +- `http://mynas:26901/vnc.html?password=headless` + +## Container user accounts + +Containers created from this image run under the **default application user** (headless, 1001:0) with the default password set also to **headless**. This password can be changed inside the container using the following command: + +```shell +passwd +``` + +Please do not confuse the **default application user** password with the **VNC user** password, because they both have the same default value. However, the former one is used for **sudo** and it can be changed using `passwd` command. The latter one is used for VNC access and it can be changed through the **VNC_PW** environment variable (see above). + +The **sudo** command allows user elevation, so the **default application user** can, for example, install new applications. + +The following example shows how to install **git**: + +```shell +sudo apt-get update +sudo apt-get install -y git +``` + +Note that the default application account's **group membership** (group zero) does not give it automatically the privileges of the **root** user. Technical details will be described in [Wiki][this-wiki]. + +The container user ID (1001 by default) can be changed by creating the container using the `--user` parameter, for example: + +```shell +docker run -it -P --rm --user 2019 accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +**Remark**: The following feature is available also for this image, but those specific image tags (`fugo`) are currently not built by default. However, you can enable the feature `FEATURES_USER_GROUP_OVERRIDE` in the hook scripts and build them yourself. + +The image supports also overriding the container user's group ID (0 by default). However, the image must be built with the argument `ARG_SUPPORT_USER_GROUP_OVERRIDE`. Otherwise the following command line would fail: + +```shell +### This will fail (Permission denied) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc + +### This will work (image built with ARG_SUPPORT_USER_GROUP_OVERRIDE) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc-fugo +``` + +The images having the tag suffix `-fugo` (**f**eatures **u**ser **g**roup **o**verride) are built just that way. + +Note that only numerical ID and GID are supported. Technical details will be described in [Wiki][this-wiki]. + +## Running containers in background (detached) + +The following container will keep running in the background and it will listen on an automatically selected TCP port on the host computer: + +```shell +docker run -dP accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +The following container will listen on the host's TCP port **25901**: + +```shell +docker run -d -p 25901:5901 accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +The following container will create (or re-use) the local named volume **my\_Downloads** mounted as `/home/headless/Downloads`: + +```shell +docker run -d -P -v my_Downloads:/home/headless/Downloads accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +or using the newer syntax with **--mount** flag: + +```shell +docker run -d -P --mount source=my_Downloads,target=/home/headless/Downloads accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +## Running containers in foreground (interactively) + +The following container can be used interactively: + +```shell +docker run -it --rm accetto/ubuntu-vnc-xfce-firefox-g3 bash +``` + +The opened `bash` session can be used as usual and then closed by entering `^C` (CTRL-C): + +```shell +To run a command as administrator (user "root"), use "sudo ". +See "man sudo_root" for details. + +headless@cf4a4e01d94b:~$ whoami +headless +headless@cf4a4e01d94b:~$ pwd +/home/headless +headless@cf4a4e01d94b:~$ +``` + +The container will remove itself. + +## Firefox multi-process + +Firefox multi-process (also known as **Electrolysis** or just **E10S**) can cause heavy crashing in Docker containers if there is not enough shared memory (**Gah. Your tab just crashed.**). + +In Firefox versions till **76.0.1** it has been possible to disable multi-process by setting the environment variable **MOZ_FORCE_DISABLE_E10S**. However, in Firefox **77.0.1** it has caused ugly scrambling of almost all web pages, because they were not decompressed. + +Mozilla has fixed the problem in the next release, but they warned about not supporting the switch in the future. That is why I've decided, that all images with Firefox will use multi-process by default, even if it requires larger shared memory. On the positive side, performance should be higher and Internet browsing should be sand-boxed. + +Please check the Wiki page [Firefox multi-process][that-wiki-firefox-multiprocess] for more information and the instructions, how the shared memory size can be set in different scenarios. + +### Setting shared memory size + +Instability of multi-process Firefox is caused by setting the shared memory size too low. Docker assigns only **64MB** by default. Testing on my computers has shown, that using at least **256MB** completely eliminates the problem. However, it could be different on your system. + +The Wiki page [Firefox multi-process][that-wiki-firefox-multiprocess] describes several ways, how to increase the shared memory size. It's really simple, if you need it for a single container started from the command line. + +For example, the following container will have its shared memory size set to 256MB: + +```shell +docker run -d -P --shm-size=256m accetto/ubuntu-vnc-xfce-firefox-g3 +``` + +You can check the current shared memory size by executing the following command inside the container: + +```shell +df -h /dev/shm +``` + +## Firefox preferences and the plus features + +Firefox browser supports pre-configuration of user preferences. + +Users can enforce their personal browser preferences if they put them into the `user.js` file and then copy it into the Firefox profile folder. The provided **plus** features make it really easy. + +There is the `/home/headless/firefox.plus` folder containing the `user.js` file and the helper utility `copy_firefox_user_preferences.sh`. It will copy the `user.js` file into one or more existing Firefox profiles. The utility is easy to use, because it is interactive and it will also display the help, if started with the `-h` or `--help` argument. + +To make it even more convenient, there are also desktop launchers for the utility and for the **Firefox Profile Manager**. + +Recommended procedure for taking advantage of the **plus** features is: + +- Start the **Firefox Profile Manager** using the desktop launcher **FF Profile Manager**. Create a new Firefox profile if there is none or you want to add one more. Wait until the profile is created and then start Firefox with it. Starting Firefox is required to create the actual profile content. + + **Hint**: You can also check the **Work offline** check-box before creating the profile. + + The Firefox profiles are created inside the `/home/headless/.mozilla/firefox` folder by default. Note that the `.mozilla` folder is hidden. + + Close the **Profile Manager** by pushing the **Exit** button. + +- Put your personal Firefox preferences into the `user.js` file which is in the `/home/headless/firefox.plus`folder. Check the Firefox documentation (e.g. [Firefox preferences][firefox-doc-preferences]) for more information about the syntax. + + **Hint**: There is also another way. You can first start Firefox, configure it and then copy the content of the `prefs.js` file from the Firefox profile folder into the `user.js` file. Then you can check the content and to keep only the preferences you really want to enforce. It's not a quick task, but you have to do it only once or until you need an update. + +- Start the helper utility using the desktop launcher **Copy FF Preferences**. The utility will allow you to copy the `user.js` file to any of the existing Firefox profiles. + + **Hint**: You preferences will be enforced until you delete the `user.js` file from the Firefox profile folder. + +It is also very easy to build customized images with pre-filled `user.js` files. + +## Startup options and help + +The image supports multiple **start-up options** and **start-up modifiers**. There also also two help modes. + +The following container will print out the short help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-firefox-g3 --help +``` + +Example of the short help text: + +```text +Container startup script +Usage: /dockerstartup/startup.sh [-v|--version] [-h|--help] [-H|--help-usage] [--(no-)wait] [--(no-)skip-startup] [--(no-)tail-null] [--(no-)tail-vnc] [--(no-)version-sticker] [--(no-)version-sticker-verbose] [--(no-)skip-vnc] [--(no-)skip-novnc] [--(no-)debug] [--(no-)verbose] [--] [] ... [] ... + : Optional command with optional arguments. It is executed during startup. + -v, --version: Prints version + -h, --help: Prints help + -H, --help-usage: Extended container usage help. + --wait, --no-wait: Default background execution mode (on by default) + --skip-startup, --no-skip-startup: Default foreground execution mode (off by default) + --tail-null, --no-tail-null: Alternative background execution mode (off by default) + --tail-vnc, --no-tail-vnc: Alternative background execution mode (off by default) + --version-sticker, --no-version-sticker: Alternative foreground execution mode (off by default) + --version-sticker-verbose, --no-version-sticker-verbose: Alternative foreground execution mode (off by default) + --skip-vnc, --no-skip-vnc: Startup process modifier (off by default) + --skip-novnc, --no-skip-novnc: Startup process modifier (off by default) + --debug, --no-debug: Startup process modifier (off by default) + --verbose, --no-verbose: Startup process modifier (off by default) + +Use '-H' or '--help-usage' for extended container usage help. +For more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +The following container will print out the long help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-chromium-g3 --help-usage +``` + +Example of the long help text: + +```text +CONTAINER USAGE: +docker run [] accetto/: [] [] + +POSITIONAL ARGUMENTS: +command + Optional command with optional arguments. + It will be executed during startup before going waiting, tailing or asleep. + It is necessary to use the quotes correctly or the 'bash -c ""' pattern. + +STARTUP OPTIONS: + +--wait, or no options, or unknown option, or empty input + Default background execution mode. + Starts the VNC and noVNC servers, if available, then executes the command + and waits until the VNC server process exits or goes asleep infinitely. + Container keeps running in the background. + +--skip-startup + Default foreground execution mode. + Skips the startup procedure, executes the command and exits. + Be aware that the container user generator will be also skipped. + Container does not keep running in the background. + +--tail-null + Alternative background execution mode. + Similar to '--wait', but tails the null device instead of going asleep. + Container keeps running in the background. + +--tail-vnc + Alternative background execution mode. + Similar to '--wait', but tails the VNC log instead of waiting until the VNC process exits. + Falls back to '--tail-null' if the VNC server has not been started. + Container keeps running in the background. + +--version-sticker + Alternative foreground execution mode. + Prints out the version sticker info. + The VNC server is also started by default, if available, because some applications + need a display to report their versions correctly. It can be suppressed by providing + also '--skip-vnc'. The '--skip-novnc' option is always enforced automatically. + Container does not keep running in the background. + +--version-sticker-verbose + Alternative foreground execution mode. + Similar to '--version-sticker', but prints out the verbose version sticker info and features list. + Container does not keep running in the background. + +--skip-vnc + Startup process modifier. + If VNC and noVNC startup should be skipped. + It also enforces '--skip-novnc'. + +--skip-novnc + Startup process modifier. + If noVNC startup should be skipped. + It is also enforced by '--skip-vnc'. + +--debug + Startup process modifier. + If additional debugging info should be displayed during startup. + It also enforces option '--verbose'. + +--verbose + Startup process modifier. + If startup progress messages should be displayed. + It is also enforced by '--debug'. + +--help-usage, -H + Prints out this extended container usage help and exits. + The rest of the input is ignored. + +--help, -h + Prints out the short startup script help and exits. + The rest of the input is ignored. + +--version, -v + Prints out the version of the startup script and exits. + The rest of the input is ignored. + +Use '-h' or '--help' for short startup script help. +Fore more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +## Issues + +If you have found a problem or you just have a question, please check the [Issues][this-issues] and the [Wiki][this-wiki] first. Please do not overlook the closed issues. + +If you do not find a solution, you can file a new issue. The better you describe the problem, the bigger the chance it'll be solved soon. + +## Credits + +Credit goes to all the countless people and companies, who contribute to open source community and make so many dreamy things real. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-dockerhub]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-firefox-g3 +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-firefox-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce.firefox + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce-firefox/ubuntu-vnc-xfce-firefox-plus.jpg + + + +[that-wiki-firefox-multiprocess]: https://github.com/accetto/xubuntu-vnc/wiki/Firefox-multiprocess + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce-firefox]: https://github.com/accetto/ubuntu-vnc-xfce-firefox +[accetto-github-ubuntu-vnc-xfce-firefox-plus]: https://github.com/accetto/ubuntu-vnc-xfce-firefox-plus + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + +[firefox]: https://www.mozilla.org +[firefox-doc-preferences]: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-firefox-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-firefox-g3?icon=docker&label=stars diff --git a/docker/xfce-firefox/readme-append.template b/docker/xfce-firefox/readme-append.template new file mode 100644 index 0000000..68f02ca --- /dev/null +++ b/docker/xfce-firefox/readme-append.template @@ -0,0 +1,42 @@ + + + + + +[badge_latest_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@created.json + +[badge_latest_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker.json + +[link_latest_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker-verbose.txt + + + +[badge_vnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@created.json + +[badge_vnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker.json + +[link_vnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker-verbose.txt + + + +[badge_vnc-novnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@created.json + +[badge_vnc-novnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker.json + +[link_vnc-novnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker-verbose.txt + + + +[badge_vnc-plus_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-plus@created.json + +[badge_vnc-plus_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-plus@version-sticker.json + +[link_vnc-plus_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-plus@version-sticker-verbose.txt + + + +[badge_vnc-novnc-plus_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-plus@created.json + +[badge_vnc-novnc-plus_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-plus@version-sticker.json + +[link_vnc-novnc-plus_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-plus@version-sticker-verbose.txt diff --git a/docker/xfce-firefox/src/firefox.plus/home/Desktop/Copy FF Preferences.desktop b/docker/xfce-firefox/src/firefox.plus/home/Desktop/Copy FF Preferences.desktop new file mode 100644 index 0000000..fefa40e --- /dev/null +++ b/docker/xfce-firefox/src/firefox.plus/home/Desktop/Copy FF Preferences.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Copy FF Preferences +Comment=Copy user.js into Firefox profiles +Exec=/home/headless/firefox.plus/copy_firefox_user_preferences.sh +Icon=accetto +Path= +Terminal=true +StartupNotify=true +GenericName=Copy FF Preferences diff --git a/docker/xfce-firefox/src/firefox.plus/home/Desktop/FF Profile Manager.desktop b/docker/xfce-firefox/src/firefox.plus/home/Desktop/FF Profile Manager.desktop new file mode 100644 index 0000000..b96e7e0 --- /dev/null +++ b/docker/xfce-firefox/src/firefox.plus/home/Desktop/FF Profile Manager.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=FF Profile Manager +Comment=Open Firefox Profile Manager +Exec=firefox -P +Icon=accetto +Path= +Terminal=false +StartupNotify=true diff --git a/docker/xfce-firefox/src/firefox.plus/resources/accetto.svg b/docker/xfce-firefox/src/firefox.plus/resources/accetto.svg new file mode 100644 index 0000000..cbb3d9f --- /dev/null +++ b/docker/xfce-firefox/src/firefox.plus/resources/accetto.svg @@ -0,0 +1,116 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/docker/xfce-firefox/src/firefox.plus/resources/copy_firefox_user_preferences.sh b/docker/xfce-firefox/src/firefox.plus/resources/copy_firefox_user_preferences.sh new file mode 100644 index 0000000..ab0492c --- /dev/null +++ b/docker/xfce-firefox/src/firefox.plus/resources/copy_firefox_user_preferences.sh @@ -0,0 +1,196 @@ +#!/bin/bash +### @accetto (https://github.com/accetto) (https://hub.docker.com/u/accetto/) + +# ARG_OPTIONAL_SINGLE([source],[s],[Source folder (where 'user.js' is).],[${HOME}/firefox.plus]) +# ARG_OPTIONAL_SINGLE([target],[t],[Target folder (where Firefox profiles are).],[${HOME}/.mozilla/firefox]) +# ARG_VERSION([echo $0 v19.06.18]) +# ARG_HELP([Copy 'user.js' into existing Firefox profiles]) +# ARGBASH_GO() +# needed because of Argbash --> m4_ignore([ +### START OF CODE GENERATED BY Argbash v2.8.0 one line above ### +# Argbash is a bash code generator used to get arguments parsing right. +# Argbash is FREE SOFTWARE, see https://argbash.io for more info + + +die() +{ + local _ret=$2 + test -n "$_ret" || _ret=1 + test "$_PRINT_HELP" = yes && print_help >&2 + echo "$1" >&2 + exit ${_ret} +} + + +begins_with_short_option() +{ + local first_option all_short_options='stvh' + first_option="${1:0:1}" + test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0 +} + +# THE DEFAULTS INITIALIZATION - OPTIONALS +_arg_source="${HOME}/firefox.plus" +_arg_target="${HOME}/.mozilla/firefox" + + +print_help() +{ + printf '%s\n' "Copy 'user.js' into existing Firefox profiles" + printf 'Usage: %s [-s|--source ] [-t|--target ] [-v|--version] [-h|--help]\n' "$0" + printf '\t%s\n' "-s, --source: Source folder (where 'user.js' is). (default: '${HOME}/firefox.plus')" + printf '\t%s\n' "-t, --target: Target folder (where Firefox profiles are). (default: '${HOME}/.mozilla/firefox')" + printf '\t%s\n' "-v, --version: Prints version" + printf '\t%s\n' "-h, --help: Prints help" +} + + +parse_commandline() +{ + while test $# -gt 0 + do + _key="$1" + case "$_key" in + -s|--source) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_source="$2" + shift + ;; + --source=*) + _arg_source="${_key##--source=}" + ;; + -s*) + _arg_source="${_key##-s}" + ;; + -t|--target) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_target="$2" + shift + ;; + --target=*) + _arg_target="${_key##--target=}" + ;; + -t*) + _arg_target="${_key##-t}" + ;; + -v|--version) + echo $0 v19.06.18 + exit 0 + ;; + -v*) + echo $0 v19.06.18 + exit 0 + ;; + -h|--help) + print_help + exit 0 + ;; + -h*) + print_help + exit 0 + ;; + *) + _PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1 + ;; + esac + shift + done +} + +parse_commandline "$@" + +# OTHER STUFF GENERATED BY Argbash + +### END OF CODE GENERATED BY Argbash (sortof) ### ]) +# [ <-- needed because of Argbash + +_counter=0 +_file_userjs="user.js" +_file_profilesini="profiles.ini" +_full_userjs="" +_full_profilesini="" +_input="" +_line=0 +_mark="" +_oldIFS="" +declare -a _list + +# LOCAL_DEBUG=true + +[[ $LOCAL_DEBUG ]] && _arg_source="." +[[ $LOCAL_DEBUG ]] && _arg_target="../.mozilla/firefox" + +fn_die() +{ + local _ret=$2 + test -n "$_ret" || _ret=1 + test "$_PRINT_HELP" = yes && print_help >&2 + echo "$1" >&2 + read -rp $"Press any key to close this window ... " -n1 _input + exit ${_ret} +} + +### source and target folders must be provided +# : ${_arg_source?} ${_arg_target?} +[[ ! ${_arg_source} ]] && fn_die "Source path must be provided!" +[[ ! ${_arg_target} ]] && fn_die "Target path must be provided!" + +_full_userjs="${_arg_source}/${_file_userjs}" +_full_profilesini="${_arg_target}/${_file_profilesini}" + +### source folder must contain 'user.js' +[[ -f "${_full_userjs}" ]] && echo "File '${_full_userjs}' found." || fn_die "File '${_full_userjs}' not found!" + +### target folder must contain 'profiles.ini' +[[ -f ${_full_profilesini} ]] && echo "File '${_full_profilesini}' found." || fn_die "File '${_full_profilesini}' not found!" + +### only profiles in 'profiles.ini' will be processed, get their count +_counter=$( grep -c -E '^Path=' "${_full_profilesini}" ) + +if [[ $_counter -gt 0 ]] ; then + + ### extract profile folder names from 'profiles.ini' into the array + ### be aware that user profile names/folders can contain spaces + _oldIFS=$IFS + IFS=$'\x0A'$'\x0D' + _list=( $( grep -E '^Path=' "${_full_profilesini}" | sed -E -e 's/^Path=//' ) ) + IFS=$_oldIFS + + echo "Following profiles found in '${_file_profilesini}' ('+|-' means with/without '${_file_userjs}'):" + _counter=0 + for p in "${_list[@]}" ; do + _counter=$((${_counter}+1)) + [[ $(ls "${_arg_target}/$p/${_file_userjs}" 2>/dev/null) ]] && _mark=" + " || _mark=" - " + printf ' %s %s %s\n' "$_counter" "$_mark" "$p" + done + + ### user interaction + read -rp $"Into which profile to copy '${_file_userjs}' (line number or 'all')? " _input + _input=$(echo ${_input,,} | grep -i -E "^[0-9]+$|^all$") + [[ ! ${_input} ]] && fn_die "INTERRUPTED: Line number or 'all' required!" + if [[ "${_input,,}" != "all" ]] ; then + + ### line number has been provided + _line=${_input} + [[ ${_line} -lt 1 || ${_line} -gt ${_counter} ]] && fn_die "Line number must be from the interval [1..${_counter}]!" + _line=$((${_line}-1)) + + ### copy 'user.js' into the selected profile folder + cp -v "${_full_userjs}" "${_arg_target}/${_list[${_line}]}/" + + else + # 'all' has been provided + ### copy 'user.js' into all profiles not containing it yet + for p in "${_list[@]}" ; do + cp -v "${_full_userjs}" "${_arg_target}/$p/" + done + fi + + fn_die "SUCCESS." 0 +else + echo "No profiles found in '${_full_profilesini}'." +fi + +fn_die "" 0 + +# ] <-- needed because of Argbash diff --git a/docker/xfce-firefox/src/firefox.plus/resources/user.js b/docker/xfce-firefox/src/firefox.plus/resources/user.js new file mode 100644 index 0000000..a06b4fa --- /dev/null +++ b/docker/xfce-firefox/src/firefox.plus/resources/user.js @@ -0,0 +1,6 @@ +// Add the preferences you want to force here. +// They will be forced for each session, but only in profiles containing this file. + +// Disable WebRTC leaks as explained in https://ipleak.net/#webrtcleak +// Be aware that this has impact on some applications, e.g. some messengers. +// user_pref("media.peerconnection.enabled", false); diff --git a/docker/xfce-firefox/src/home/Desktop/firefox.desktop b/docker/xfce-firefox/src/home/Desktop/firefox.desktop new file mode 100644 index 0000000..0c2d32d --- /dev/null +++ b/docker/xfce-firefox/src/home/Desktop/firefox.desktop @@ -0,0 +1,222 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox Web Browser +Name[ar]=متصفح الويب فَيَرفُكْس +Name[ast]=Restolador web Firefox +Name[bn]=ফায়ারফক্স ওয়েব ব্রাউজার +Name[ca]=Navegador web Firefox +Name[cs]=Firefox Webový prohlížeč +Name[da]=Firefox - internetbrowser +Name[el]=Περιηγητής Firefox +Name[es]=Navegador web Firefox +Name[et]=Firefoxi veebibrauser +Name[fa]=مرورگر اینترنتی Firefox +Name[fi]=Firefox-selain +Name[fr]=Navigateur Web Firefox +Name[gl]=Navegador web Firefox +Name[he]=דפדפן האינטרנט Firefox +Name[hr]=Firefox web preglednik +Name[hu]=Firefox webböngésző +Name[it]=Firefox Browser Web +Name[ja]=Firefox ウェブ・ブラウザ +Name[ko]=Firefox 웹 브라우저 +Name[ku]=Geroka torê Firefox +Name[lt]=Firefox interneto naršyklė +Name[nb]=Firefox Nettleser +Name[nl]=Firefox webbrowser +Name[nn]=Firefox Nettlesar +Name[no]=Firefox Nettleser +Name[pl]=Przeglądarka WWW Firefox +Name[pt]=Firefox Navegador Web +Name[pt_BR]=Navegador Web Firefox +Name[ro]=Firefox – Navigator Internet +Name[ru]=Веб-браузер Firefox +Name[sk]=Firefox - internetový prehliadač +Name[sl]=Firefox spletni brskalnik +Name[sv]=Firefox webbläsare +Name[tr]=Firefox Web Tarayıcısı +Name[ug]=Firefox توركۆرگۈ +Name[uk]=Веб-браузер Firefox +Name[vi]=Trình duyệt web Firefox +Name[zh_CN]=Firefox 网络浏览器 +Name[zh_TW]=Firefox 網路瀏覽器 +Comment=Browse the World Wide Web +Comment[ar]=تصفح الشبكة العنكبوتية العالمية +Comment[ast]=Restola pela Rede +Comment[bn]=ইন্টারনেট ব্রাউজ করুন +Comment[ca]=Navegueu per la web +Comment[cs]=Prohlížení stránek World Wide Webu +Comment[da]=Surf på internettet +Comment[de]=Im Internet surfen +Comment[el]=Μπορείτε να περιηγηθείτε στο διαδίκτυο (Web) +Comment[es]=Navegue por la web +Comment[et]=Lehitse veebi +Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید +Comment[fi]=Selaa Internetin WWW-sivuja +Comment[fr]=Naviguer sur le Web +Comment[gl]=Navegar pola rede +Comment[he]=גלישה ברחבי האינטרנט +Comment[hr]=Pretražite web +Comment[hu]=A világháló böngészése +Comment[it]=Esplora il web +Comment[ja]=ウェブを閲覧します +Comment[ko]=웹을 돌아 다닙니다 +Comment[ku]=Li torê bigere +Comment[lt]=Naršykite internete +Comment[nb]=Surf på nettet +Comment[nl]=Verken het internet +Comment[nn]=Surf på nettet +Comment[no]=Surf på nettet +Comment[pl]=Przeglądanie stron WWW +Comment[pt]=Navegue na Internet +Comment[pt_BR]=Navegue na Internet +Comment[ro]=Navigați pe Internet +Comment[ru]=Доступ в Интернет +Comment[sk]=Prehliadanie internetu +Comment[sl]=Brskajte po spletu +Comment[sv]=Surfa på webben +Comment[tr]=İnternet'te Gezinin +Comment[ug]=دۇنيادىكى توربەتلەرنى كۆرگىلى بولىدۇ +Comment[uk]=Перегляд сторінок Інтернету +Comment[vi]=Để duyệt các trang web +Comment[zh_CN]=浏览互联网 +Comment[zh_TW]=瀏覽網際網路 +GenericName=Web Browser +GenericName[ar]=متصفح ويب +GenericName[ast]=Restolador Web +GenericName[bn]=ওয়েব ব্রাউজার +GenericName[ca]=Navegador web +GenericName[cs]=Webový prohlížeč +GenericName[da]=Webbrowser +GenericName[el]=Περιηγητής διαδικτύου +GenericName[es]=Navegador web +GenericName[et]=Veebibrauser +GenericName[fa]=مرورگر اینترنتی +GenericName[fi]=WWW-selain +GenericName[fr]=Navigateur Web +GenericName[gl]=Navegador Web +GenericName[he]=דפדפן אינטרנט +GenericName[hr]=Web preglednik +GenericName[hu]=Webböngésző +GenericName[it]=Browser web +GenericName[ja]=ウェブ・ブラウザ +GenericName[ko]=웹 브라우저 +GenericName[ku]=Geroka torê +GenericName[lt]=Interneto naršyklė +GenericName[nb]=Nettleser +GenericName[nl]=Webbrowser +GenericName[nn]=Nettlesar +GenericName[no]=Nettleser +GenericName[pl]=Przeglądarka WWW +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador Web +GenericName[ro]=Navigator Internet +GenericName[ru]=Веб-браузер +GenericName[sk]=Internetový prehliadač +GenericName[sl]=Spletni brskalnik +GenericName[sv]=Webbläsare +GenericName[tr]=Web Tarayıcı +GenericName[ug]=توركۆرگۈ +GenericName[uk]=Веб-браузер +GenericName[vi]=Trình duyệt Web +GenericName[zh_CN]=网络浏览器 +GenericName[zh_TW]=網路瀏覽器 +Keywords=Internet;WWW;Browser;Web;Explorer +Keywords[ar]=انترنت;إنترنت;متصفح;ويب;وب +Keywords[ast]=Internet;WWW;Restolador;Web;Esplorador +Keywords[ca]=Internet;WWW;Navegador;Web;Explorador;Explorer +Keywords[cs]=Internet;WWW;Prohlížeč;Web;Explorer +Keywords[da]=Internet;Internettet;WWW;Browser;Browse;Web;Surf;Nettet +Keywords[de]=Internet;WWW;Browser;Web;Explorer;Webseite;Site;surfen;online;browsen +Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ +Keywords[es]=Explorador;Internet;WWW +Keywords[fi]=Internet;WWW;Browser;Web;Explorer;selain;Internet-selain;internetselain;verkkoselain;netti;surffaa +Keywords[fr]=Internet;WWW;Browser;Web;Explorer;Fureteur;Surfer;Navigateur +Keywords[he]=דפדפן;אינטרנט;רשת;אתרים;אתר;פיירפוקס;מוזילה; +Keywords[hr]=Internet;WWW;preglednik;Web +Keywords[hu]=Internet;WWW;Böngésző;Web;Háló;Net;Explorer +Keywords[it]=Internet;WWW;Browser;Web;Navigatore +Keywords[is]=Internet;WWW;Vafri;Vefur;Netvafri;Flakk +Keywords[ja]=Internet;WWW;Web;インターネット;ブラウザ;ウェブ;エクスプローラ +Keywords[nb]=Internett;WWW;Nettleser;Explorer;Web;Browser;Nettside +Keywords[nl]=Internet;WWW;Browser;Web;Explorer;Verkenner;Website;Surfen;Online +Keywords[pt]=Internet;WWW;Browser;Web;Explorador;Navegador +Keywords[pt_BR]=Internet;WWW;Browser;Web;Explorador;Navegador +Keywords[ru]=Internet;WWW;Browser;Web;Explorer;интернет;браузер;веб;файрфокс;огнелис +Keywords[sk]=Internet;WWW;Prehliadač;Web;Explorer +Keywords[sl]=Internet;WWW;Browser;Web;Explorer;Brskalnik;Splet +Keywords[tr]=İnternet;WWW;Tarayıcı;Web;Gezgin;Web sitesi;Site;sörf;çevrimiçi;tara +Keywords[uk]=Internet;WWW;Browser;Web;Explorer;Інтернет;мережа;переглядач;оглядач;браузер;веб;файрфокс;вогнелис;перегляд +Keywords[vi]=Internet;WWW;Browser;Web;Explorer;Trình duyệt;Trang web +Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站; +Keywords[zh_TW]=Internet;WWW;Browser;Web;Explorer;網際網路;網路;瀏覽器;上網;網頁;火狐 +Exec=firefox %u +Terminal=false +X-MultipleArgs=false +Type=Application +Icon=firefox +Categories=GNOME;GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; +StartupNotify=true +Actions=new-window;new-private-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ar]=افتح نافذة جديدة +Name[ast]=Abrir una ventana nueva +Name[bn]=Abrir una ventana nueva +Name[ca]=Obre una finestra nova +Name[cs]=Otevřít nové okno +Name[da]=Åbn et nyt vindue +Name[de]=Ein neues Fenster öffnen +Name[el]=Νέο παράθυρο +Name[es]=Abrir una ventana nueva +Name[fi]=Avaa uusi ikkuna +Name[fr]=Ouvrir une nouvelle fenêtre +Name[gl]=Abrir unha nova xanela +Name[he]=פתיחת חלון חדש +Name[hr]=Otvori novi prozor +Name[hu]=Új ablak nyitása +Name[it]=Apri una nuova finestra +Name[ja]=新しいウィンドウを開く +Name[ko]=새 창 열기 +Name[ku]=Paceyeke nû veke +Name[lt]=Atverti naują langą +Name[nb]=Åpne et nytt vindu +Name[nl]=Nieuw venster openen +Name[pt]=Abrir nova janela +Name[pt_BR]=Abrir nova janela +Name[ro]=Deschide o fereastră nouă +Name[ru]=Новое окно +Name[sk]=Otvoriť nové okno +Name[sl]=Odpri novo okno +Name[sv]=Öppna ett nytt fönster +Name[tr]=Yeni pencere aç +Name[ug]=يېڭى كۆزنەك ئېچىش +Name[uk]=Відкрити нове вікно +Name[vi]=Mở cửa sổ mới +Name[zh_CN]=新建窗口 +Name[zh_TW]=開啟新視窗 +Exec=firefox -new-window + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ar]=افتح نافذة جديدة للتصفح الخاص +Name[ca]=Obre una finestra nova en mode d'incògnit +Name[cs]=Otevřít nové anonymní okno +Name[de]=Ein neues privates Fenster öffnen +Name[el]=Νέο ιδιωτικό παράθυρο +Name[es]=Abrir una ventana privada nueva +Name[fi]=Avaa uusi yksityinen ikkuna +Name[fr]=Ouvrir une nouvelle fenêtre de navigation privée +Name[he]=פתיחת חלון גלישה פרטית חדש +Name[hu]=Új privát ablak nyitása +Name[it]=Apri una nuova finestra anonima +Name[nb]=Åpne et nytt privat vindu +Name[ru]=Новое приватное окно +Name[sl]=Odpri novo okno zasebnega brskanja +Name[sv]=Öppna ett nytt privat fönster +Name[tr]=Yeni gizli pencere aç +Name[uk]=Відкрити нове вікно у потайливому режимі +Name[zh_TW]=開啟新隱私瀏覽視窗 +Exec=firefox -private-window diff --git a/docker/xfce-firefox/src/startup/version_sticker.sh b/docker/xfce-firefox/src/startup/version_sticker.sh new file mode 100644 index 0000000..8be860e --- /dev/null +++ b/docker/xfce-firefox/src/startup/version_sticker.sh @@ -0,0 +1,62 @@ +#!/bin/bash +### @accetto, September 2019 + +### resolve also symlinks +_current_dir="$(dirname "$(readlink -f "$0")")" + +ubuntu=$("${_current_dir}/version_of.sh" ubuntu) +firefox=$("${STARTUPDIR}/version_of.sh" firefox) + +main() { + local key + + if [ $# -gt 0 ] ; then + while [ $# -gt 0 ] ; do + key="$1" + if [ "${key}" = '--' ] ; then shift ; fi + case "${key}" in + -h ) + echo "Usage: version_sticker [-h] [-v] [-V] [-f]" + echo "-h help" + echo "-v short version sticker" + echo "-V verbose version sticker" + echo "-f features" + ;; + -v ) + echo "Ubuntu ${ubuntu}" + echo "Firefox ${firefox}" + ;; + -V ) + echo "Ubuntu ${ubuntu}" + version=$("${_current_dir}/version_of.sh" nano) + if [ -n "${version}" ] ; then echo "nano ${version}" ; fi + version=$("${_current_dir}/version_of.sh" jq) + if [ -n "${version}" ] ; then echo "jq ${version}" ; fi + version=$("${_current_dir}/version_of.sh" mousepad) + if [ -n "${version}" ] ; then echo "Mousepad ${version}" ; fi + version=$("${_current_dir}/version_of.sh" tigervnc) + if [ -n "${version}" ] ; then echo "TigerVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" screenshooter) + if [ -n "${version}" ] ; then echo "xfce4-screenshooter ${version}" ; fi + version=$("${_current_dir}/version_of.sh" ristretto) + if [ -n "${version}" ] ; then echo "Ristretto ${version}" ; fi + version=$("${_current_dir}/version_of.sh" novnc) + if [ -n "${version}" ] ; then echo "noVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" websockify) + if [ -n "${version}" ] ; then echo "websockify ${version}" ; fi + echo "Firefox ${firefox}" + ;; + -f ) + env | grep "FEATURES_" | sort + ;; + esac + shift + done + else + ### example: ubuntu20.04.1-firefox81.0 + sticker="ubuntu${ubuntu}"-"firefox${firefox}" + echo "${sticker}" + fi +} + +main $@ diff --git a/docker/xfce-firefox/ubuntu-vnc-xfce-firefox-plus.jpg b/docker/xfce-firefox/ubuntu-vnc-xfce-firefox-plus.jpg new file mode 100644 index 0000000..749c925 Binary files /dev/null and b/docker/xfce-firefox/ubuntu-vnc-xfce-firefox-plus.jpg differ diff --git a/docker/xfce-firefox/ubuntu-vnc-xfce-firefox.jpg b/docker/xfce-firefox/ubuntu-vnc-xfce-firefox.jpg new file mode 100644 index 0000000..561c6fa Binary files /dev/null and b/docker/xfce-firefox/ubuntu-vnc-xfce-firefox.jpg differ diff --git a/docker/xfce/README-dockerhub.md b/docker/xfce/README-dockerhub.md new file mode 100644 index 0000000..4f6f5aa --- /dev/null +++ b/docker/xfce/README-dockerhub.md @@ -0,0 +1,128 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC + +## accetto/ubuntu-vnc-xfce-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Full Readme][this-readme-full] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +*** + +**Tip** This is the short README version for Docker Hub. There is also the [full-length README][this-readme-full] on GitHub. + +*** + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment and [VNC][tigervnc]/[noVNC][novnc] servers for headless use. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repository [accetto/ubuntu-vnc-xfce][accetto-github-ubuntu-vnc-xfce]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +- utilities **ping**, **wget**, **sudo** (Ubuntu distribution) +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc` + + ![badge_latest_created][badge_latest_created] + [![badge_latest_version-sticker][badge_latest_version-sticker]][link_latest_version-sticker-verbose] + +- `vnc` implements only VNC + + ![badge_vnc_created][badge_vnc_created] + [![badge_vnc_version-sticker][badge_vnc_version-sticker]][link_vnc_version-sticker-verbose] + +- `vnc-novnc` implements VNC and noVNC + + ![badge_vnc-novnc_created][badge_vnc-novnc_created] + [![badge_vnc-novnc_version-sticker][badge_vnc-novnc_version-sticker]][link_vnc-novnc_version-sticker-verbose] + +- `vnc-fugo` implements only VNC and supports user group overriding + + ![badge_vnc-fugo_created][badge_vnc-fugo_created] + [![badge_vnc-fugo_version-sticker][badge_vnc-fugo_version-sticker]][link_vnc-fugo_version-sticker-verbose] + +- `vnc-novnc-fugo` implements VNC/noVNC and supports user group overriding + + ![badge_vnc-fugo-novnc_created][badge_vnc-novnc-fugo_created] + [![badge_vnc-novnc-fugo_version-sticker][badge_vnc-novnc-fugo_version-sticker]][link_vnc-novnc-fugo_version-sticker-verbose] + +Clicking on the version sticker badge reveals more information about the actual configuration of the image. + +### More information + +More information about these images can be found in the [full-length README][this-readme-full] file on GitHub. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-full]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/xfce/README.md +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce/ubuntu-vnc-xfce-g3.jpg + + + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce]: https://github.com/accetto/ubuntu-vnc-xfce + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-g3?icon=docker&label=stars + + diff --git a/docker/xfce/README.md b/docker/xfce/README.md new file mode 100644 index 0000000..083d220 --- /dev/null +++ b/docker/xfce/README.md @@ -0,0 +1,409 @@ +# Headless Ubuntu/Xfce container with VNC/noVNC + +## accetto/ubuntu-vnc-xfce-g3 + +[Docker Hub][this-docker] - [Git Hub][this-github] - [Dockerfile][this-dockerfile] - [Docker Readme][this-readme-dockerhub] - [Changelog][this-changelog] - [Project Readme][this-readme-project] - [Wiki][this-wiki] + +![badge-docker-pulls][badge-docker-pulls] +![badge-docker-stars][badge-docker-stars] +![badge-github-release][badge-github-release] +![badge-github-release-date][badge-github-release-date] + +- [Headless Ubuntu/Xfce container with VNC/noVNC](#headless-ubuntuxfce-container-with-vncnovnc) + - [accetto/ubuntu-vnc-xfce-g3](#accettoubuntu-vnc-xfce-g3) + - [Image tags](#image-tags) + - [Ports](#ports) + - [Volumes](#volumes) + - [Version sticker](#version-sticker) + - [Using headless containers](#using-headless-containers) + - [Over VNC](#over-vnc) + - [Over noVNC](#over-novnc) + - [Container user accounts](#container-user-accounts) + - [Running containers in background (detached)](#running-containers-in-background-detached) + - [Running containers in foreground (interactively)](#running-containers-in-foreground-interactively) + - [Startup options and help](#startup-options-and-help) + - [Issues](#issues) + - [Credits](#credits) + +This repository contains resources for building Docker images based on [Ubuntu 20.04 LTS][docker-ubuntu] with [Xfce][xfce] desktop environment and [VNC][tigervnc]/[noVNC][novnc] servers for headless use. + +This is the **third generation** (G3) of my headless images. The **second generation** (G2) of similar images is contained in the GitHub repositories [accetto/xubuntu-vnc][accetto-github-xubuntu-vnc] and [accetto/xubuntu-vnc-novnc][accetto-github-xubuntu-vnc-novnc]. The **first generation** (G1) of similar images is contained in the GitHub repository [accetto/ubuntu-vnc-xfce][accetto-github-ubuntu-vnc-xfce]. + +More information about the image generations can be found in the [project README][this-readme-project] file and in [Wiki][this-wiki]. + +The main features and components of the images in the default configuration are: + +- utilities **ping**, **wget**, **sudo** (Ubuntu distribution) +- current version of JSON processor [jq][jq] +- light-weight [Xfce][xfce] desktop environment (Ubuntu distribution) +- current version of high-performance [TigerVNC][tigervnc] server and client +- current version of [noVNC][novnc] HTML5 clients (full and lite) (TCP port **6901**) +- popular text editor [nano][nano] (Ubuntu distribution) +- lite but advanced graphical editor [mousepad][mousepad] (Ubuntu distribution) +- current version of [tini][tini] as the entry-point initial process (PID 1) +- support for overriding both the container user account and its group +- support of **version sticker** (see below) + +The history of notable changes is documented in the [CHANGELOG][this-changelog]. + +![container-screenshot][this-screenshot-container] + +### Image tags + +The following image tags are regularly maintained and rebuilt: + +- `latest` is identical to `vnc-novnc` +- `vnc` implements only VNC +- `vnc-novnc` implements VNC and noVNC +- `vnc-fugo` implements only VNC and supports user group overriding +- `vnc-novnc-fugo` implements VNC/noVNC and supports user group overriding + +Clicking on the version sticker badge in the [README on Docker Hub][this-readme-dockerhub] reveals more information about the actual configuration of the image. + +### Ports + +Following **TCP** ports are exposed: + +- **5901** used for access over **VNC** +- **6901** used for access over [noVNC][novnc] + +### Volumes + +The containers do not create or use any external volumes by default. However, the following folders make good mounting points: `/home/headless/Documents/`, `/home/headless/Downloads/`, `/home/headless/Pictures/`, `/home/headless/Public/` + +Both **named volumes** and **bind mounts** can be used. More about volumes can be found in the [Docker documentation][docker-doc] (e.g. [Manage data in Docker][docker-doc-managing-data]). + +### Version sticker + +Version sticker serves multiple purposes that are closer described in [Wiki][this-wiki]. Note that the usage of the version sticker has changed between the generations of images. + +The **short version sticker value** identifies the version of the docker image and it is persisted in its *label* when the image is built. It is also shown as a badge in the README file. + +The **verbose version sticker value** is used by the CI builder to decide if the image needs to be refreshed. It describes the actual configuration of essential components of the image. It can be revealed by clicking on the version sticker badge in the README file. + +The version sticker values are generated by the script `version_sticker.sh`, which is deployed into the startup directory `/dockerstartup`. The script will show a short help if executed with the argument `-h`. There is also a convenient `Version Sticker` launcher on the container desktop. + +## Using headless containers + +There are two ways, how to use the created headless containers. + +The default **VNC user** password is **headless** and it can be changed through the environment variable **VNC_PW**. For example the following container would use the password value **mynewpwd**: + +```shell +docker run -d -P -e VNC_PW=mynewpwd accetto/ubuntu-vnc-xfce-g3 +``` + +The argument `-P` means that the **VNC** and **noVNC** ports exposed by the container will be bound to the next free TCP ports on the host. It is also possible to bind them explicitly. For example: + +```shell +docker run -d -p 25901:5901 -p 26901:6901 accetto/ubuntu-vnc-xfce-g3 +``` + +In this case, if the host is named `mynas`, then **VNC** is accessible as `mynas:25091` and **noVNC** as `mynas:26901`. + +### Over VNC + +To be able to use the containers over **VNC**, some **VNC Viewer** is needed (e.g. [TigerVNC][tigervnc] or [TightVNC][tightvnc]). + +The VNC Viewer should connect to the host running the container, pointing to its TCP port mapped to the container's TCP port **5901**. + +For example, if the container has been created on the host called `mynas` using the parameters described above, the VNC Viewer should connect to `mynas:25901`. + +### Over noVNC + +To be able to use the containers over [noVNC][novnc], an HTML5 capable web browser is needed. It actually means, that any current web browser can be used. + +The browser should navigate to the host running the container, pointing to its TCP port mapped to the container's TCP port **6901**. + +The containers offer two [noVNC][novnc] clients - the **lite** client and the **full** client with more features. The connection URL differs slightly in both cases. To make it easier, a **simple startup page** is implemented. + +For example, if the container has been created on the host called `mynas` using the parameters described above, then the web browser should navigate to `http://mynas:26901`. + +The startup page will show two hyperlinks pointing to the both noVNC clients: + +- `http://mynas:26901/vnc_lite.html` +- `http://mynas:26901/vnc.html` + +It's also possible to provide the password through the links: + +- `http://mynas:26901/vnc_lite.html?password=headless` +- `http://mynas:26901/vnc.html?password=headless` + +## Container user accounts + +Containers created from this image run under the **default application user** (headless, 1001:0) with the default password set also to **headless**. This password can be changed inside the container using the following command: + +```shell +passwd +``` + +Please do not confuse the **default application user** password with the **VNC user** password, because they both have the same default value. However, the former one is used for **sudo** and it can be changed using `passwd` command. The latter one is used for VNC access and it can be changed through the **VNC_PW** environment variable (see above). + +The **sudo** command allows user elevation, so the **default application user** can, for example, install new applications. + +The following example shows how to install **git**: + +```shell +sudo apt-get update +sudo apt-get install -y git +``` + +Note that the default application account's **group membership** (group zero) does not give it automatically the privileges of the **root** user. Technical details will be described in [Wiki][this-wiki]. + +The container user ID (1001 by default) can be changed by creating the container using the `--user` parameter, for example: + +```shell +docker run -it -P --rm --user 2019 accetto/ubuntu-vnc-xfce-g3 +``` + +The image supports also overriding the container user's group ID (0 by default). However, the image must be built with the argument `ARG_SUPPORT_USER_GROUP_OVERRIDE`. Otherwise the following command line would fail: + +```shell +### This will fail (Permission denied) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc + +### This will work (image built with ARG_SUPPORT_USER_GROUP_OVERRIDE) +docker run -it -P --rm --user 2019:2000 accetto/ubuntu-vnc-xfce-g3:vnc-novnc-fugo +``` + +The images having the tag suffix `-fugo` (**f**eatures **u**ser **g**roup **o**verride) are built just that way. + +Note that only numerical ID and GID are supported. Technical details will be described in [Wiki][this-wiki]. + +## Running containers in background (detached) + +The following container will keep running in the background and it will listen on an automatically selected TCP port on the host computer: + +```shell +docker run -dP accetto/ubuntu-vnc-xfce-g3 +``` + +The following container will listen on the host's TCP port **25901**: + +```shell +docker run -d -p 25901:5901 accetto/ubuntu-vnc-xfce-g3 +``` + +The following container will create (or re-use) the local named volume **my\_Downloads** mounted as `/home/headless/Downloads`: + +```shell +docker run -d -P -v my_Downloads:/home/headless/Downloads accetto/ubuntu-vnc-xfce-g3 +``` + +or using the newer syntax with **--mount** flag: + +```shell +docker run -d -P --mount source=my_Downloads,target=/home/headless/Downloads accetto/ubuntu-vnc-xfce-g3 +``` + +## Running containers in foreground (interactively) + +The following container can be used interactively: + +```shell +docker run -it --rm accetto/ubuntu-vnc-xfce-g3 bash +``` + +The opened `bash` session can be used as usual and then closed by entering `^C` (CTRL-C): + +```shell +To run a command as administrator (user "root"), use "sudo ". +See "man sudo_root" for details. + +headless@cf4a4e01d94b:~$ whoami +headless +headless@cf4a4e01d94b:~$ pwd +/home/headless +headless@cf4a4e01d94b:~$ +``` + +The container will remove itself. + +## Startup options and help + +The image supports multiple **start-up options** and **start-up modifiers**. There also also two help modes. + +The following container will print out the short help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-g3 --help +``` + +Example of the short help text: + +```text +Container startup script +Usage: /dockerstartup/startup.sh [-v|--version] [-h|--help] [-H|--help-usage] [--(no-)wait] [--(no-)skip-startup] [--(no-)tail-null] [--(no-)tail-vnc] [--(no-)version-sticker] [--(no-)version-sticker-verbose] [--(no-)skip-vnc] [--(no-)skip-novnc] [--(no-)debug] [--(no-)verbose] [--] [] ... [] ... + : Optional command with optional arguments. It is executed during startup. + -v, --version: Prints version + -h, --help: Prints help + -H, --help-usage: Extended container usage help. + --wait, --no-wait: Default background execution mode (on by default) + --skip-startup, --no-skip-startup: Default foreground execution mode (off by default) + --tail-null, --no-tail-null: Alternative background execution mode (off by default) + --tail-vnc, --no-tail-vnc: Alternative background execution mode (off by default) + --version-sticker, --no-version-sticker: Alternative foreground execution mode (off by default) + --version-sticker-verbose, --no-version-sticker-verbose: Alternative foreground execution mode (off by default) + --skip-vnc, --no-skip-vnc: Startup process modifier (off by default) + --skip-novnc, --no-skip-novnc: Startup process modifier (off by default) + --debug, --no-debug: Startup process modifier (off by default) + --verbose, --no-verbose: Startup process modifier (off by default) + +Use '-H' or '--help-usage' for extended container usage help. +For more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +The following container will print out the long help and then it will remove itself: + +```shell +docker run --rm accetto/ubuntu-vnc-xfce-g3 --help-usage +``` + +Example of the long help text: + +```text +CONTAINER USAGE: +docker run [] accetto/: [] [] + +POSITIONAL ARGUMENTS: +command + Optional command with optional arguments. + It will be executed during startup before going waiting, tailing or asleep. + It is necessary to use the quotes correctly or the 'bash -c ""' pattern. + +STARTUP OPTIONS: + +--wait, or no options, or unknown option, or empty input + Default background execution mode. + Starts the VNC and noVNC servers, if available, then executes the command + and waits until the VNC server process exits or goes asleep infinitely. + Container keeps running in the background. + +--skip-startup + Default foreground execution mode. + Skips the startup procedure, executes the command and exits. + Be aware that the container user generator will be also skipped. + Container does not keep running in the background. + +--tail-null + Alternative background execution mode. + Similar to '--wait', but tails the null device instead of going asleep. + Container keeps running in the background. + +--tail-vnc + Alternative background execution mode. + Similar to '--wait', but tails the VNC log instead of waiting until the VNC process exits. + Falls back to '--tail-null' if the VNC server has not been started. + Container keeps running in the background. + +--version-sticker + Alternative foreground execution mode. + Prints out the version sticker info. + The VNC server is also started by default, if available, because some applications + need a display to report their versions correctly. It can be suppressed by providing + also '--skip-vnc'. The '--skip-novnc' option is always enforced automatically. + Container does not keep running in the background. + +--version-sticker-verbose + Alternative foreground execution mode. + Similar to '--version-sticker', but prints out the verbose version sticker info and features list. + Container does not keep running in the background. + +--skip-vnc + Startup process modifier. + If VNC and noVNC startup should be skipped. + It also enforces '--skip-novnc'. + +--skip-novnc + Startup process modifier. + If noVNC startup should be skipped. + It is also enforced by '--skip-vnc'. + +--debug + Startup process modifier. + If additional debugging info should be displayed during startup. + It also enforces option '--verbose'. + +--verbose + Startup process modifier. + If startup progress messages should be displayed. + It is also enforced by '--debug'. + +--help-usage, -H + Prints out this extended container usage help and exits. + The rest of the input is ignored. + +--help, -h + Prints out the short startup script help and exits. + The rest of the input is ignored. + +--version, -v + Prints out the version of the startup script and exits. + The rest of the input is ignored. + +Use '-h' or '--help' for short startup script help. +Fore more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3 +``` + +## Issues + +If you have found a problem or you just have a question, please check the [Issues][this-issues] and the [Wiki][this-wiki] first. Please do not overlook the closed issues. + +If you do not find a solution, you can file a new issue. The better you describe the problem, the bigger the chance it'll be solved soon. + +## Credits + +Credit goes to all the countless people and companies, who contribute to open source community and make so many dreamy things real. + +*** + + + +[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ +[this-changelog]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/CHANGELOG.md +[this-readme-dockerhub]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-g3 +[this-readme-project]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/README.md +[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki +[this-issues]: https://github.com/accetto/ubuntu-vnc-xfce-g3/issues + + + + +[this-docker]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-g3/ +[this-dockerfile]: https://github.com/accetto/ubuntu-vnc-xfce-g3/blob/master/docker/Dockerfile.xfce + +[this-screenshot-container]: https://raw.githubusercontent.com/accetto/ubuntu-vnc-xfce-g3/master/docker/xfce/ubuntu-vnc-xfce-g3.jpg + + + +[accetto-github-xubuntu-vnc]: https://github.com/accetto/xubuntu-vnc/ +[accetto-github-xubuntu-vnc-novnc]: https://github.com/accetto/xubuntu-vnc-novnc/ +[accetto-github-ubuntu-vnc-xfce]: https://github.com/accetto/ubuntu-vnc-xfce + + + +[docker-ubuntu]: https://hub.docker.com/_/ubuntu/ + +[docker-doc]: https://docs.docker.com/ +[docker-doc-managing-data]: https://docs.docker.com/storage/ + +[jq]: https://stedolan.github.io/jq/ +[mousepad]: https://github.com/codebrainz/mousepad +[nano]: https://www.nano-editor.org/ +[novnc]: https://github.com/kanaka/noVNC +[tigervnc]: http://tigervnc.org +[tightvnc]: http://www.tightvnc.com +[tini]: https://github.com/krallin/tini +[xfce]: http://www.xfce.org + + + +[badge-github-release]: https://badgen.net/github/release/accetto/ubuntu-vnc-xfce-g3?icon=github&label=release + +[badge-github-release-date]: https://img.shields.io/github/release-date/accetto/ubuntu-vnc-xfce-g3?logo=github + + + +[badge-docker-pulls]: https://badgen.net/docker/pulls/accetto/ubuntu-vnc-xfce-g3?icon=docker&label=pulls + +[badge-docker-stars]: https://badgen.net/docker/stars/accetto/ubuntu-vnc-xfce-g3?icon=docker&label=stars diff --git a/docker/xfce/readme-append.template b/docker/xfce/readme-append.template new file mode 100644 index 0000000..e2c8064 --- /dev/null +++ b/docker/xfce/readme-append.template @@ -0,0 +1,42 @@ + + + + + +[badge_latest_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@created.json + +[badge_latest_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker.json + +[link_latest_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@latest@version-sticker-verbose.txt + + + +[badge_vnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@created.json + +[badge_vnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker.json + +[link_vnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc@version-sticker-verbose.txt + + + +[badge_vnc-novnc_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@created.json + +[badge_vnc-novnc_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker.json + +[link_vnc-novnc_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc@version-sticker-verbose.txt + + + +[badge_vnc-fugo_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-fugo@created.json + +[badge_vnc-fugo_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-fugo@version-sticker.json + +[link_vnc-fugo_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-fugo@version-sticker-verbose.txt + + + +[badge_vnc-novnc-fugo_created]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-fugo@created.json + +[badge_vnc-novnc-fugo_version-sticker]: https://badgen.net/https/gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-fugo@version-sticker.json + +[link_vnc-novnc-fugo_version-sticker-verbose]: https://gist.githubusercontent.com/${OWNER}/${GIST}/raw/${REPO}@vnc-novnc-fugo@version-sticker-verbose.txt diff --git a/docker/xfce/src/home/Desktop/versionsticker.desktop b/docker/xfce/src/home/Desktop/versionsticker.desktop new file mode 100644 index 0000000..facbc7b --- /dev/null +++ b/docker/xfce/src/home/Desktop/versionsticker.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Version Sticker +Comment=Verbose version sticker +Exec=bash -c 'echo "Wait..." ; /dockerstartup/version_sticker.sh -f -V ; read -p "Press ENTER..."' +Path=/dockerstartup +Terminal=true +StartupNotify=false diff --git a/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml b/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml new file mode 100644 index 0000000..8a3ed7f --- /dev/null +++ b/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml b/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml new file mode 100644 index 0000000..c94164a --- /dev/null +++ b/docker/xfce/src/home/config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/xfce/src/startup/help.rc b/docker/xfce/src/startup/help.rc new file mode 100644 index 0000000..accb3aa --- /dev/null +++ b/docker/xfce/src/startup/help.rc @@ -0,0 +1,87 @@ +print_usage() { + local readonly github_repo_url="https://github.com/accetto/ubuntu-vnc-xfce-g3" + + echo " +CONTAINER USAGE: +docker run [] accetto/: [] [] + +POSITIONAL ARGUMENTS: +command + Optional command with optional arguments. + It will be executed during startup before going waiting, tailing or asleep. + It is necessary to use the quotes correctly or the 'bash -c \"\"' pattern. + +STARTUP OPTIONS: + +--wait, or no options, or unknown option, or empty input + Default background execution mode. + Starts the VNC and noVNC servers, if available, then executes the command + and waits until the VNC server process exits or goes asleep infinitely. + Container keeps running in the background. + +--skip-startup + Default foreground execution mode. + Skips the startup procedure, executes the command and exits. + Be aware that the container user generator will be also skipped. + Container does not keep running in the background. + +--tail-null + Alternative background execution mode. + Similar to '--wait', but tails the null device instead of going asleep. + Container keeps running in the background. + +--tail-vnc + Alternative background execution mode. + Similar to '--wait', but tails the VNC log instead of waiting until the VNC process exits. + Falls back to '--tail-null' if the VNC server has not been started. + Container keeps running in the background. + +--version-sticker + Alternative foreground execution mode. + Prints out the version sticker info. + The VNC server is also started by default, if available, because some applications + need a display to report their versions correctly. It can be suppressed by providing + also '--skip-vnc'. The '--skip-novnc' option is always enforced automatically. + Container does not keep running in the background. + +--version-sticker-verbose + Alternative foreground execution mode. + Similar to '--version-sticker', but prints out the verbose version sticker info and features list. + Container does not keep running in the background. + +--skip-vnc + Startup process modifier. + If VNC and noVNC startup should be skipped. + It also enforces '--skip-novnc'. + +--skip-novnc + Startup process modifier. + If noVNC startup should be skipped. + It is also enforced by '--skip-vnc'. + +--debug + Startup process modifier. + If additional debugging info should be displayed during startup. + It also enforces option '--verbose'. + +--verbose + Startup process modifier. + If startup progress messages should be displayed. + It is also enforced by '--debug'. + +--help-usage, -H + Prints out this extended container usage help and exits. + The rest of the input is ignored. + +--help, -h + Prints out the short startup script help and exits. + The rest of the input is ignored. + +--version, -v + Prints out the version of the startup script and exits. + The rest of the input is ignored. + +Use '-h' or '--help' for short startup script help. +Fore more information visit ${github_repo_url} +" +} diff --git a/docker/xfce/src/startup/parser.rc b/docker/xfce/src/startup/parser.rc new file mode 100644 index 0000000..78dd58f --- /dev/null +++ b/docker/xfce/src/startup/parser.rc @@ -0,0 +1,207 @@ +#!/bin/bash + +### If using 'accetto/argbash-docker' image, then rebuild as 'argbash parser.rc --strip user-content' +### Then test it as './startup.sh -v' or './startup.sh -h' or './startup.sh -H' + +# Created by argbash-init v2.8.1 +# ARG_VERSION([echo $(basename $0) v20.12.06]) +# ARG_HELP([Container startup script],[Use '-H' or '--help-usage' for extended container usage help.\nFor more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3]) +# ARG_OPTIONAL_ACTION([help-usage],[H],[Extended container usage help.],[print_usage]) +# +# ARG_POSITIONAL_INF([command],[Optional command with optional arguments. It is executed during startup.]) +# +# ARG_POSITIONAL_DOUBLEDASH([]) +# +# ARG_OPTIONAL_BOOLEAN([wait],[],[Default background execution mode],[on]) +# ARG_OPTIONAL_BOOLEAN([skip-startup],[],[Default foreground execution mode]) +# +# ARG_OPTIONAL_BOOLEAN([tail-null],[],[Alternative background execution mode]) +# ARG_OPTIONAL_BOOLEAN([tail-vnc],[],[Alternative background execution mode]) +# +# ARG_OPTIONAL_BOOLEAN([version-sticker],[],[Alternative foreground execution mode]) +# ARG_OPTIONAL_BOOLEAN([version-sticker-verbose],[],[Alternative foreground execution mode]) +# +# ARG_OPTIONAL_BOOLEAN([skip-vnc],[],[Startup process modifier]) +# ARG_OPTIONAL_BOOLEAN([skip-novnc],[],[Startup process modifier]) +# ARG_OPTIONAL_BOOLEAN([debug],[],[Startup process modifier]) +# ARG_OPTIONAL_BOOLEAN([verbose],[],[Startup process modifier]) +# +# ARGBASH_GO() +# needed because of Argbash --> m4_ignore([ +### START OF CODE GENERATED BY Argbash v2.8.1 one line above ### +# Argbash is a bash code generator used to get arguments parsing right. +# Argbash is FREE SOFTWARE, see https://argbash.io for more info + + +die() +{ + local _ret="${2:-1}" + test "${_PRINT_HELP:-no}" = yes && print_help >&2 + echo "$1" >&2 + exit "${_ret}" +} + + +begins_with_short_option() +{ + local first_option all_short_options='vhH' + first_option="${1:0:1}" + test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0 +} + +# THE DEFAULTS INITIALIZATION - POSITIONALS +_positionals=() +_arg_command=() +# THE DEFAULTS INITIALIZATION - OPTIONALS +_arg_wait="on" +_arg_skip_startup="off" +_arg_tail_null="off" +_arg_tail_vnc="off" +_arg_version_sticker="off" +_arg_version_sticker_verbose="off" +_arg_skip_vnc="off" +_arg_skip_novnc="off" +_arg_debug="off" +_arg_verbose="off" + + +print_help() +{ + printf '%s\n' "Container startup script" + printf 'Usage: %s [-v|--version] [-h|--help] [-H|--help-usage] [--(no-)wait] [--(no-)skip-startup] [--(no-)tail-null] [--(no-)tail-vnc] [--(no-)version-sticker] [--(no-)version-sticker-verbose] [--(no-)skip-vnc] [--(no-)skip-novnc] [--(no-)debug] [--(no-)verbose] [--] [] ... [] ...\n' "$0" + printf '\t%s\n' ": Optional command with optional arguments. It is executed during startup." + printf '\t%s\n' "-v, --version: Prints version" + printf '\t%s\n' "-h, --help: Prints help" + printf '\t%s\n' "-H, --help-usage: Extended container usage help." + printf '\t%s\n' "--wait, --no-wait: Default background execution mode (on by default)" + printf '\t%s\n' "--skip-startup, --no-skip-startup: Default foreground execution mode (off by default)" + printf '\t%s\n' "--tail-null, --no-tail-null: Alternative background execution mode (off by default)" + printf '\t%s\n' "--tail-vnc, --no-tail-vnc: Alternative background execution mode (off by default)" + printf '\t%s\n' "--version-sticker, --no-version-sticker: Alternative foreground execution mode (off by default)" + printf '\t%s\n' "--version-sticker-verbose, --no-version-sticker-verbose: Alternative foreground execution mode (off by default)" + printf '\t%s\n' "--skip-vnc, --no-skip-vnc: Startup process modifier (off by default)" + printf '\t%s\n' "--skip-novnc, --no-skip-novnc: Startup process modifier (off by default)" + printf '\t%s\n' "--debug, --no-debug: Startup process modifier (off by default)" + printf '\t%s\n' "--verbose, --no-verbose: Startup process modifier (off by default)" + printf '\n%s\n' "Use '-H' or '--help-usage' for extended container usage help. +For more information visit https://github.com/accetto/ubuntu-vnc-xfce-g3" +} + + +parse_commandline() +{ + _positionals_count=0 + while test $# -gt 0 + do + _key="$1" + if test "$_key" = '--' + then + shift + test $# -gt 0 || break + _positionals+=("$@") + _positionals_count=$((_positionals_count + $#)) + shift $(($# - 1)) + _last_positional="$1" + break + fi + case "$_key" in + -v|--version) + echo $(basename $0) v20.12.06 + exit 0 + ;; + -v*) + echo $(basename $0) v20.12.06 + exit 0 + ;; + -h|--help) + print_help + exit 0 + ;; + -h*) + print_help + exit 0 + ;; + -H|--help-usage) + print_usage + exit 0 + ;; + -H*) + print_usage + exit 0 + ;; + --no-wait|--wait) + _arg_wait="on" + test "${1:0:5}" = "--no-" && _arg_wait="off" + ;; + --no-skip-startup|--skip-startup) + _arg_skip_startup="on" + test "${1:0:5}" = "--no-" && _arg_skip_startup="off" + ;; + --no-tail-null|--tail-null) + _arg_tail_null="on" + test "${1:0:5}" = "--no-" && _arg_tail_null="off" + ;; + --no-tail-vnc|--tail-vnc) + _arg_tail_vnc="on" + test "${1:0:5}" = "--no-" && _arg_tail_vnc="off" + ;; + --no-version-sticker|--version-sticker) + _arg_version_sticker="on" + test "${1:0:5}" = "--no-" && _arg_version_sticker="off" + ;; + --no-version-sticker-verbose|--version-sticker-verbose) + _arg_version_sticker_verbose="on" + test "${1:0:5}" = "--no-" && _arg_version_sticker_verbose="off" + ;; + --no-skip-vnc|--skip-vnc) + _arg_skip_vnc="on" + test "${1:0:5}" = "--no-" && _arg_skip_vnc="off" + ;; + --no-skip-novnc|--skip-novnc) + _arg_skip_novnc="on" + test "${1:0:5}" = "--no-" && _arg_skip_novnc="off" + ;; + --no-debug|--debug) + _arg_debug="on" + test "${1:0:5}" = "--no-" && _arg_debug="off" + ;; + --no-verbose|--verbose) + _arg_verbose="on" + test "${1:0:5}" = "--no-" && _arg_verbose="off" + ;; + *) + _last_positional="$1" + _positionals+=("$_last_positional") + _positionals_count=$((_positionals_count + 1)) + ;; + esac + shift + done +} + + +assign_positional_args() +{ + local _positional_name _shift_for=$1 + _positional_names="" + _our_args=$((${#_positionals[@]} - 0)) + for ((ii = 0; ii < _our_args; ii++)) + do + _positional_names="$_positional_names _arg_command[$((ii + 0))]" + done + + shift "$_shift_for" + for _positional_name in ${_positional_names} + do + test $# -gt 0 || break + eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1 + shift + done +} + +parse_commandline "$@" +assign_positional_args 1 "${_positionals[@]}" + +# OTHER STUFF GENERATED BY Argbash + +### END OF CODE GENERATED BY Argbash (sortof) ### ]) diff --git a/docker/xfce/src/startup/set_user_permissions.sh b/docker/xfce/src/startup/set_user_permissions.sh new file mode 100644 index 0000000..647749b --- /dev/null +++ b/docker/xfce/src/startup/set_user_permissions.sh @@ -0,0 +1,36 @@ +#!/bin/bash +### every exit != 0 fails the script +#set -e # do not use +#set -u # do not use + +main() { + local verbose="" + + if [ -n "${DEBUG}" ] ; then + echo "Current user: $(id -u)" + verbose="-v" + fi + + ### Fix file permissions + for i in "$@" ; do + + if [ -n "${verbose}" ] ; then echo "Fixing permissions for: ${i}" ; fi + + ### folder and its current content belong to the group zero for better portability (recursively) + chgrp -R 0 "$i" + + ### group members allowed to execute current '*.sh' scripts in the folder (recursively) + find "$i"/ -name '*.sh' -exec chmod ${verbose} g+x {} + + + ### group members allowed to execute current launchers in the folder (recursively) + find "$i"/ -name '*.desktop' -exec chmod ${verbose} g+x {} + + + ### all users have write permissions to the current folder content (recursively) + chmod -R ${verbose} a+rw "$i" + + ### all users have execute permissions to all current folder directories (recursively) + find "$i" -type d -exec chmod ${verbose} a+x {} + + done +} + +main $@ diff --git a/docker/xfce/src/startup/startup.sh b/docker/xfce/src/startup/startup.sh new file mode 100644 index 0000000..38f5c19 --- /dev/null +++ b/docker/xfce/src/startup/startup.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +#set -e ### do not use this + +declare _mydir=$(dirname $0) + +source "${_mydir}"/help.rc +source "${_mydir}"/parser.rc +source "${_mydir}"/user_generator.rc +source "${_mydir}"/vnc_startup.rc + +cleanup () { + local readonly last_pid=$! + + ### also forwarding of shutdown signal + if [ -n "${last_pid}" ] || [ -n "${_wait_pid}" ] ; then + + if [ "${last_pid}" != "${_wait_pid}" ] ; then + if [ -n "${_verbose}" ] ; then echo "Killing last background PID '${last_pid}'" ; fi + kill -s SIGTERM "${last_pid}" + fi + + ### kill the PID the container is waiting on + if [ -n "${_wait_pid}" ] ; then + if [ -n "${_verbose}" ] ; then echo "Killing blocking PID '${_wait_pid}'" ; fi + ### ignore the errors if not alive any more + kill -s SIGTERM "${_wait_pid}" > /dev/null 2>&1 + fi + fi + + die "$1" 0 +} + +execute_command() { + + if [ -n "$@" ] ; then + + if [ -n "${_verbose}" ] ; then echo "Executing startup command: $@" ; fi + + ### use 'eval' not 'exec' + ### note the single space before the command! + eval " $@" + + if [ $? -ne 0 ] ; then + cleanup + fi + fi +} + +main() { + + ### option interdependencies + if [ "${_arg_verbose}" == "on" ] || [ "${_arg_debug}" == "on" ] ; then + _verbose=1 + fi + if [ "${_arg_skip_vnc}" == "on" ] ; then + _arg_skip_novnc="on" + fi + + ### option "--debug" + if [ "${_arg_debug}" == "on" ] ; then + echo "Script: $0" + echo "\${HOME}=${HOME}" + + echo "ls -la /" ; ls -la / + echo "ls -ls /etc/passwd /etc/group" ; ls -ls /etc/passwd /etc/group + echo "ls -la /home" ; ls -la /home + echo "ls -la ${HOME}" ; ls -la "${HOME}" + echo "ls -la ." ; ls -la . + fi + + ### create container user + generate_container_user + + if [ "$?" != "0" ] ; then + echo "ERROR: Unable to generate the container user '$(id -u):$(id -g)'." + if [ $(id -g) -ne 0 ] ; then + echo -e "HINT: You have overriden also the user's group ID. Be sure to use an image \nthat has been built with the build argument ARG_FEATURES_USER_GROUP_OVERRIDE." + fi + cleanup + fi + + ### options '--version-sticker' and '--version-sticker-verbose' + if [ "${_arg_version_sticker}" == "on" ] || [ "${_arg_version_sticker_verbose}" == "on" ] ; then + + ### this handles also '--skip-vnc' and '--skip-novnc' options + start_vnc + + ### do not use '_verbose' which can be forced by '--debug' + if [ "${_arg_version_sticker_verbose}" == "off" ] ; then + + ### print out default version sticker + "${STARTUPDIR}"/version_sticker.sh + cleanup + + else + ### print out verbose version sticker + ### be sure to use capital '-V' + "${STARTUPDIR}"/version_sticker.sh -f -V + cleanup + fi + fi + + ### options '--tail-vnc' and '--tail-null' + if [ "${_arg_tail_vnc}" == "on" ] || [ ${_arg_tail_null} == "on" ] ; then + + ### this handles also '--skip-vnc' and '--skip-novnc' options + start_vnc + + ### command array expands to all elements quoted as a whole + execute_command "${_arg_command[*]}" + + ### option '--tail-vnc' and VNC has been started + if [ ${_arg_tail_vnc} == "on" ] && [ -n "${_wait_pid}" ] ; then + + ### tail the VNC log infinitely + echo "Tailing VNC log '${_vnc_log}'" + tail -f "${_vnc_log}" + cleanup + + else + + ### tail the null device infinitelly + if [ -n $"{_verbose}" ] ; then echo "Tailing '/dev/null'" ; fi + tail -f /dev/null + cleanup + fi + fi + + ### default backround execution mode + ### be sure to end all previous branches by calling 'cleanup' + ### option '--wait' is purely because of the parser + + ### this handles also '--skip-vnc' and '--skip-novnc' options + start_vnc + + ### command array expands to all elements quoted as a whole + execute_command "${_arg_command[*]}" + + if [ -n "${_wait_pid}" ] ; then + + ### VNC has been started - wait on its PID + wait ${_wait_pid} + else + + ### VNC not started - go asleep infinitely + sleep infinity + fi +} + +### MAIN ENTRY POINT + +if [ -z "${DEBUGGER}" ] ; then + trap cleanup SIGINT SIGTERM ERR + : ${HOME?} ${STARTUPDIR?} +fi + +declare _novnc_log="${STARTUPDIR}"/novnc.log +declare _verbose="" +declare _vnc_log="${STARTUPDIR}"/vnc.log +declare _wait_pid="" + +### option '--skip-startup' +if [ "${_arg_skip_startup}" == "on" ] ; then + + ### command array expands to all elements quoted as a whole + execute_command "${_arg_command[*]}" + +else + + main $@ + +fi + +cleanup diff --git a/docker/xfce/src/startup/user_generator.rc b/docker/xfce/src/startup/user_generator.rc new file mode 100644 index 0000000..0c4653f --- /dev/null +++ b/docker/xfce/src/startup/user_generator.rc @@ -0,0 +1,50 @@ +generate_container_user() { + ### Override user ID lookup to cope with being randomly assigned IDs using 'docker run --user x:y'. + ### It is assumed, that there is no user or group named 'headless' yet. + + local user_id=$(id -u) + local group_id=$(id -g) + + ### only in debug mode + if [ ${DEBUG} ] ; then + id + echo "ls -la /etc/passwd" ; ls -la /etc/passwd + echo "ls -la /etc/group" ; ls -la /etc/group + fi + + ### user 'root (0)' is created by default and 'headless (1001)' by Dockerfile + if [ "${user_id}" != "0" ] && [ "${user_id}" != "1001" ] ; then + + ### this test fails if the current user misses permissions + touch /etc/passwd + if [ "$?" != "0" ] ; then return 1 ; fi + + ### rename an existing default application user 'headless (1001)' to 'builder (1001)' + if [ $( grep -c 'headless:x:1001:' /etc/passwd ) -ne 0 ] ; then + cat /etc/passwd | sed -e "s/^headless:x:1001:0:Default:/builder:x:1001:0:Builder:/" > /tmp/passwd + cp /tmp/passwd /etc/ + rm /tmp/passwd + if [ -n "${_verbose}" ] ; then echo "User 'headless (1001:0)' renamed to 'builder (1001:0)' in '/etc/passwd'" ; fi + fi + + ### add the current user ID as a new default application user 'headless', but only once + if [ $( grep -c "headless:x:${user_id}:" /etc/passwd ) -eq 0 ] ; then + cat /etc/passwd > /tmp/passwd + echo "headless:x:${user_id}:${group_id}:Default:${HOME}:/bin/bash" >> /tmp/passwd + cp /tmp/passwd /etc/ + rm /tmp/passwd + if [ -n "${_verbose}" ] ; then echo "User 'headless (${user_id}:${group_id})' added into '/etc/passwd'" ; fi + fi + + if [ "${group_id}" != "0" ] ; then + ### add the new group if the same GID does not exist yet + if [ $( grep -c -E ":x:${group_id}:$" /etc/group ) -eq 0 ] ; then + cat /etc/group > /tmp/group + echo "headless:x:${group_id}:" >> /tmp/group + cp /tmp/group /etc/ + rm /tmp/group + if [ -n "${_verbose}" ] ; then echo "Group 'headless (${group_id})' added into '/etc/group'" ; fi + fi + fi + fi +} diff --git a/docker/xfce/src/startup/version_of.sh b/docker/xfce/src/startup/version_of.sh new file mode 100644 index 0000000..8e954aa --- /dev/null +++ b/docker/xfce/src/startup/version_of.sh @@ -0,0 +1,112 @@ +#!/bin/bash +### @accetto, September 2019 + +case "$1" in + angular | angular-cli | angularcli | ng) + ### source example: Angular CLI: 8.3.2 + echo $(ng --version 2>/dev/null | grep -Po '(?<=Angular CLI:\s)[0-9.]+') + ;; + chromium | chromium-browser | chromiumbrowser | chrome) + ### source example: Chromium 76.0.3809.100 Built on Ubuntu , running on Ubuntu 18.04 + echo $(chromium-browser --version 2>/dev/null | grep -Po '(?<=Chromium\s)[0-9.]+') + ;; + code | vsc | vscode | visual-studio-code | visualstudiocode) + ### source example: 1.37.1 + echo $(code --version 2>/dev/null | grep -Po '^[0-9.]+$') + ;; + curl) + ### source example: curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3 + echo $(curl --version 2>/dev/null | grep -Po '(?<=curl\s)[0-9.]+') + ;; + draw | drawio | drawio-desktop) + ### source example: 12.2.2 + echo $(drawio --no-sandbox --version 2>/dev/null | grep -Po '^[0-9.]+$') + ;; + firefox | fox) + ### source example: Mozilla Firefox 68.0.2 + echo $(firefox -v 2>/dev/null | grep -Po '(?<=Firefox\s)[0-9a-zA-Z.-]+') + ;; + gimp) + ### source example: GNU Image Manipulation Program version 2.8.22 + echo $(gimp --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; + gdebi) + ### source example: 0.9.5.7+nmu2 + echo $(gdebi --version 2>/dev/null | grep -Po '^[0-9.]+') + ;; + git) + ### source example: git version 2.17.1 + echo $(git --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; + heroku | heroku-cli | herokucli) + ### source sample: heroku/7.29.0 linux-x64 node-v11.14.0 + echo $(heroku --version 2>/dev/null | grep -Po '(?<=heroku/)[0-9.]+') + ;; + inkscape | ink) + ### Inkscape requires display! + ### source sample: Inkscape 0.92.3 (2405546, 2018-03-11) + echo $(inkscape --version 2>/dev/null | grep -Po '(?<=Inkscape\s)[0-9.]+') + ;; + jq) + ### source sample: jq-1.5-1-a5b5cbe + echo $(jq --version 2>/dev/null | grep -Po '(?<=jq\-)[0-9.]+') + ;; + mousepad) + ### Mousepad requires display! + ### source example: Mousepad 0.4.0 + echo $(mousepad --version 2>/dev/null | grep -Po '(?<=Mousepad\s)[0-9.]+') + ;; + nano) + ### source example: GNU nano, version 4.8 + echo $(nano --version 2>/dev/null | grep -Po '(?<=version\s)[0-9.]+') + ;; + node | nodejs | node-js) + ### source example: v10.16.3 + echo $(node --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; + novnc | no-vnc) + ### source example: 1.1.0 + #echo $(cat "${NO_VNC_HOME}"/VERSION 2>/dev/null | grep -Po '^[0-9.]+$') + echo $(cat "${NO_VNC_HOME}"/package.json 2>/dev/null | grep -Po '(?<=\s"version":\s")[0-9.]+') + ;; + npm) + ### source example: 6.9.0 + echo $(npm --version 2>/dev/null) + ;; + psql | postgresql | postgre-sql | postgre) + ### source example: psql (PostgreSQL) 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1) + echo $(psql --version 2>/dev/null | grep -Po '(?<=psql \(PostgreSQL\)\s)[0-9.]+') + ;; + ristretto) + ### source example: ristretto 0.8.2 + echo $(ristretto --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; + tigervnc | tiger-vnc | vncserver | vnc-server | vnc) + ### till TigerVNC 1.10.1 + ### source example: Xvnc TigerVNC 1.9.0 - built Jul 16 2018 14:18:04 + # echo $(vncserver -version 2>/dev/null | grep -Po '(?<=Xvnc TigerVNC\s)[0-9.]+') + ### since TigerVNC 1.11.0 (it's coming out on the stderr stream!) + ### source example: Xvnc TigerVNC 1.11.0 - built Sep 8 2020 12:27:03 + echo $(Xvnc -version 2>&1 | grep -Po '(?<=Xvnc TigerVNC\s)[0-9.]+') + ;; + tsc | typescript | type-script) + ### source example: Version 3.6.2 + echo $(tsc --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; + ubuntu | xubuntu) + ### source example: Ubuntu 18.04.3 LTS + echo $(cat /etc/os-release 2>/dev/null | grep -Po '(?<=VERSION\=")[0-9.]+') + ;; + vim) + ### source example: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41) + echo $(vim --version 2>/dev/null | grep -Po '(?<=VIM - Vi IMproved\s)[0-9.]+') + ;; + websockify) + ### source example: 0.8.0 + echo $(cat "${NO_VNC_HOME}"/utils/websockify/CHANGES.txt 2>/dev/null | grep -Po -m1 '^[0-9.]+') + ;; + xfce4-screenshooter | screenshooter | screenshot) + ### source example: xfce4-screenshooter 1.8.2 + echo $(xfce4-screenshooter --version 2>/dev/null | grep -Po '[0-9.]+$') + ;; +esac diff --git a/docker/xfce/src/startup/version_sticker.sh b/docker/xfce/src/startup/version_sticker.sh new file mode 100644 index 0000000..e452210 --- /dev/null +++ b/docker/xfce/src/startup/version_sticker.sh @@ -0,0 +1,59 @@ +#!/bin/bash +### @accetto, September 2019 + +### resolve also symlinks +_current_dir="$(dirname "$(readlink -f "$0")")" + +ubuntu=$("${_current_dir}/version_of.sh" ubuntu) + +main() { + local key + + if [ $# -gt 0 ] ; then + while [ $# -gt 0 ] ; do + key="$1" + if [ "${key}" = '--' ] ; then shift ; fi + case "${key}" in + -h ) + echo "Usage: version_sticker [-h] [-v] [-V] [-f]" + echo "-h help" + echo "-v short version sticker" + echo "-V verbose version sticker" + echo "-f features" + ;; + -v ) + echo "Ubuntu ${ubuntu}" + ;; + -V ) + echo "Ubuntu ${ubuntu}" + version=$("${_current_dir}/version_of.sh" nano) + if [ -n "${version}" ] ; then echo "nano ${version}" ; fi + version=$("${_current_dir}/version_of.sh" jq) + if [ -n "${version}" ] ; then echo "jq ${version}" ; fi + version=$("${_current_dir}/version_of.sh" mousepad) + if [ -n "${version}" ] ; then echo "Mousepad ${version}" ; fi + version=$("${_current_dir}/version_of.sh" tigervnc) + if [ -n "${version}" ] ; then echo "TigerVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" screenshooter) + if [ -n "${version}" ] ; then echo "xfce4-screenshooter ${version}" ; fi + version=$("${_current_dir}/version_of.sh" ristretto) + if [ -n "${version}" ] ; then echo "Ristretto ${version}" ; fi + version=$("${_current_dir}/version_of.sh" novnc) + if [ -n "${version}" ] ; then echo "noVNC ${version}" ; fi + version=$("${_current_dir}/version_of.sh" websockify) + if [ -n "${version}" ] ; then echo "websockify ${version}" ; fi + ;; + -f ) + env | grep "FEATURES_" | sort + ;; + esac + shift + done + else + ### example: ubuntu20.04.1 + sticker="ubuntu${ubuntu}" + echo "${sticker}" + fi +} + +main $@ diff --git a/docker/xfce/src/startup/vnc_startup.rc b/docker/xfce/src/startup/vnc_startup.rc new file mode 100644 index 0000000..b773dee --- /dev/null +++ b/docker/xfce/src/startup/vnc_startup.rc @@ -0,0 +1,96 @@ + +start_vnc () { + local vnc_ip + local passwd_path + local xinit_pid + + ### option '--skip-vnc' + if [ "${_arg_skip_vnc}" == "on" ] ; then + if [ -n "${_verbose}" ] ; then echo "INFO: VNC/noVNC startup skipped as requested." ; fi + return 0 + fi + + if [ -z "$(which vncserver)" ] ; then + if [ -n "${_verbose}" ] ; then echo "WARNING: No 'vncserver' is available." ; fi + return 0 + fi + + ### VNC requirements + if [ -z "${DISPLAY}" ] \ + || [ -z "${VNC_PORT}" ] \ + || [ -z "${VNC_PW}" ] \ + || [ -z "${VNC_COL_DEPTH}" ] \ + || [ -z "${VNC_RESOLUTION}" ] ; then + cleanup "ERROR: Not all required environment variables are set: DISPLAY, VNC_PORT,VNC_PW, VNC_COL_DEPTH, VNC_RESOLUTION" + fi + + passwd_path="${HOME}"/.vnc/passwd + if [ ! -d "${HOME}"/.vnc ] ; then mkdir "${HOME}"/.vnc ; fi + + if [ "${VNC_VIEW_ONLY,,}" == "true" ]; then + if [ -n "${_verbose}" ] ; then echo "Starting VNC server in view-only mode ..." ; fi + ### create random pw to prevent access + echo $(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 20) | vncpasswd -f > "${passwd_path}" + fi + + echo "${VNC_PW}" | vncpasswd -f >> "${passwd_path}" + chmod 600 "${passwd_path}" + + ### create VNC configuration file + echo " + depth=${VNC_COL_DEPTH} + geometry=${VNC_RESOLUTION} + " > "${HOME}"/.vnc/config + + ### get container IP address + vnc_ip=$(hostname -i) + + ### removing old VNC locks to be a re-attachable container + xinit_pid="$(pidof xinit)" + if [ -n "${xinit_pid}" ] ; then + if [ -n "${_verbose}" ] ; then echo "Killing xinit PID ${xinit_pid}" ; fi + ### ignore the errors if not alive any more + kill "${xinit_pid}" > /dev/null 2>&1 + fi + if [ -n $(compgen -G /tmp/.X*-lock) ] || [ -n $(compgen -G /tmp/.X11-unix) ] ; then + if [ -n "${_verbose}" ] ; then echo "Removing old VNC locks to be a re-attachable container" ; fi + rm -rfv /tmp/.X*-lock /tmp/.X11-unix &> "${_vnc_log}" + fi + + ### VNC startup (in the background) + vncserver "${DISPLAY}" &> "${_vnc_log}" & + + ### container will wait on this VNC server PID + _wait_pid=$! + + if [ -n "${_verbose}" ] ; then + echo "VNC server started on display '${DISPLAY}' and TCP port '${VNC_PORT}'" + echo "Connect via VNC viewer with ${vnc_ip}:${VNC_PORT}" + fi + + ### option '--skip-novnc' + if [ "${_arg_skip_novnc}" == "off" ] ; then + + ### noVNC is not necessarily installed + if [ -n "${NO_VNC_HOME}" ] || [ -d "${NO_VNC_HOME}/utils/websockify" ] ; then + + ### noVNC requirements + if [ -n "${NO_VNC_PORT}" ] ; then + + ### noVNC startup (in the background) + "${NO_VNC_HOME}"/utils/launch.sh --vnc localhost:${VNC_PORT} --listen ${NO_VNC_PORT} &> "${_novnc_log}" & + + if [ -n "${_verbose}" ] ; then + echo "noVNC started on TCP port '${NO_VNC_PORT}'" + echo "Connect via web browser" + fi + else + cleanup "ERROR: Environment variable 'NO_VNC_PORT' is not set." + fi + else + if [ -n "${_verbose}" ] ; then echo "WARNING: noVNC is not available." ; fi + fi + else + if [ -n "${_verbose}" ] ; then echo "INFO: noVNC startup skipped as requested." ; fi + fi +} diff --git a/docker/xfce/ubuntu-vnc-xfce-g3.jpg b/docker/xfce/ubuntu-vnc-xfce-g3.jpg new file mode 100644 index 0000000..b8b08ab Binary files /dev/null and b/docker/xfce/ubuntu-vnc-xfce-g3.jpg differ