From 3e9bc4b6d9fd07f2d3c04e6f7f5af624e6fa4e3c Mon Sep 17 00:00:00 2001 From: thelamer Date: Wed, 25 Sep 2024 23:09:28 -0400 Subject: [PATCH 1/2] noble rebase if needed, current Alpine head is not working --- .github/workflows/external_trigger.yml | 12 ++------ Dockerfile | 34 +++++++++------------- Dockerfile.aarch64 | 34 +++++++++------------- Jenkinsfile | 18 +++++------- README.md | 34 +++++++++++++++++++++- jenkins-vars.yml | 8 ++--- readme-vars.yml | 34 +++++++++++++++++++++- root/etc/apt/preferences.d/firefox-no-snap | 3 ++ 8 files changed, 109 insertions(+), 68 deletions(-) create mode 100644 root/etc/apt/preferences.d/firefox-no-snap diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index a228e7f..bef9d7c 100644 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -21,9 +21,8 @@ jobs: echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY echo "> External trigger running off of master branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_FIREFOX_MASTER\`" >> $GITHUB_STEP_SUMMARY printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY - EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:'"firefox"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') - echo "Type is \`alpine_repo\`" >> $GITHUB_STEP_SUMMARY + EXT_RELEASE=$(curl -s -L https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/dists/noble/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: firefox' | awk -F ': ' '/Version/{print $2;exit}' | sed 's|[+~,]||g') + echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY echo "> Can't retrieve external version, exiting" >> $GITHUB_STEP_SUMMARY @@ -75,13 +74,6 @@ jobs: if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY exit 0 - elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/community/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"firefox"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then - echo "New version \`${EXT_RELEASE}\` found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY - FAILURE_REASON="New version ${EXT_RELEASE} for firefox tag latest is detected, however not all arch repos are updated yet. Will try again later." - curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903, - "description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}], - "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }} - exit 0 elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-firefox/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then echo "New version \`${EXT_RELEASE}\` found; but there already seems to be an active build on Jenkins; exiting" >> $GITHUB_STEP_SUMMARY exit 0 diff --git a/Dockerfile b/Dockerfile index 9f9a222..ee6f5ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-kasmvnc:alpine320 +FROM ghcr.io/linuxserver/baseimage-kasmvnc:ubuntunoble # set version label ARG BUILD_DATE @@ -10,31 +10,25 @@ LABEL maintainer="thelamer" # title ENV TITLE=Firefox +# prevent Ubuntu's firefox stub from being installed +COPY /root/etc/apt/preferences.d/firefox-no-snap /etc/apt/preferences.d/firefox-no-snap + RUN \ echo "**** add icon ****" && \ curl -o \ /kclient/public/icon.png \ https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/firefox-logo.png && \ echo "**** install packages ****" && \ - if [ -z ${FIREFOX_VERSION+x} ]; then \ - FIREFOX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:firefox$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ - fi && \ - apk add --no-cache \ - firefox==${FIREFOX_VERSION} && \ - echo "**** lang support ****" && \ - FF_VERSION=$(curl -sI https://download.mozilla.org/?product=firefox-latest | awk -F '(releases/|/win32)' '/Location/ {print $2}') && \ - REL_URL="https://releases.mozilla.org/pub/firefox/releases/${FF_VERSION}/win64/xpi/" && \ - LANGS=$(curl -Ls ${REL_URL} | awk -F '(xpi">|)' '/href.*xpi/ {print $2}' | tr '\n' ' ') && \ - EXT_DIR=/usr/lib/firefox/distribution/extensions/ && \ - mkdir -p ${EXT_DIR} && \ - for LANG in ${LANGS}; do \ - LANGCODE=$(echo ${LANG} | sed 's/\.xpi//g'); \ - echo "Downloading ${LANG} Language pack"; \ - curl -o \ - ${EXT_DIR}langpack-${LANGCODE}@firefox.mozilla.org.xpi -Ls \ - ${REL_URL}${LANG};\ - done && \ + apt-key adv \ + --keyserver hkp://keyserver.ubuntu.com:80 \ + --recv-keys 738BEB9321D1AAEC13EA9391AEBDF4819BE21867 && \ + echo \ + "deb https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu noble main" > \ + /etc/apt/sources.list.d/firefox.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + firefox \ + ^firefox-locale && \ echo "**** default firefox settings ****" && \ FIREFOX_SETTING="/usr/lib/firefox/browser/defaults/preferences/firefox.js" && \ echo 'pref("datareporting.policy.firstRunURL", "");' > ${FIREFOX_SETTING} && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7c414b4..5666a9b 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-kasmvnc:arm64v8-alpine320 +FROM ghcr.io/linuxserver/baseimage-kasmvnc:arm64v8-ubuntunoble # set version label ARG BUILD_DATE @@ -10,31 +10,25 @@ LABEL maintainer="thelamer" # title ENV TITLE=Firefox +# prevent Ubuntu's firefox stub from being installed +COPY /root/etc/apt/preferences.d/firefox-no-snap /etc/apt/preferences.d/firefox-no-snap + RUN \ echo "**** add icon ****" && \ curl -o \ /kclient/public/icon.png \ https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/firefox-logo.png && \ echo "**** install packages ****" && \ - if [ -z ${FIREFOX_VERSION+x} ]; then \ - FIREFOX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:firefox$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ - fi && \ - apk add --no-cache \ - firefox==${FIREFOX_VERSION} && \ - echo "**** lang support ****" && \ - FF_VERSION=$(curl -sI https://download.mozilla.org/?product=firefox-latest | awk -F '(releases/|/win32)' '/Location/ {print $2}') && \ - REL_URL="https://releases.mozilla.org/pub/firefox/releases/${FF_VERSION}/win64/xpi/" && \ - LANGS=$(curl -Ls ${REL_URL} | awk -F '(xpi">|)' '/href.*xpi/ {print $2}' | tr '\n' ' ') && \ - EXT_DIR=/usr/lib/firefox/distribution/extensions/ && \ - mkdir -p ${EXT_DIR} && \ - for LANG in ${LANGS}; do \ - LANGCODE=$(echo ${LANG} | sed 's/\.xpi//g'); \ - echo "Downloading ${LANG} Language pack"; \ - curl -o \ - ${EXT_DIR}langpack-${LANGCODE}@firefox.mozilla.org.xpi -Ls \ - ${REL_URL}${LANG};\ - done && \ + apt-key adv \ + --keyserver hkp://keyserver.ubuntu.com:80 \ + --recv-keys 738BEB9321D1AAEC13EA9391AEBDF4819BE21867 && \ + echo \ + "deb https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu noble main" > \ + /etc/apt/sources.list.d/firefox.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + firefox \ + ^firefox-locale && \ echo "**** default firefox settings ****" && \ FIREFOX_SETTING="/usr/lib/firefox/browser/defaults/preferences/firefox.js" && \ echo 'pref("datareporting.policy.firstRunURL", "");' > ${FIREFOX_SETTING} && \ diff --git a/Jenkinsfile b/Jenkinsfile index e259ab0..797ff27 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,10 +26,7 @@ pipeline { DOCKERHUB_IMAGE = 'linuxserver/firefox' DEV_DOCKERHUB_IMAGE = 'lsiodev/firefox' PR_DOCKERHUB_IMAGE = 'lspipepr/firefox' - DIST_IMAGE = 'alpine' - DIST_TAG = '3.20' - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/community/' - DIST_REPO_PACKAGES = 'firefox' + DIST_IMAGE = 'ubuntu' MULTIARCH = 'true' CI = 'true' CI_WEB = 'true' @@ -129,15 +126,14 @@ pipeline { /* ######################## External Release Tagging ######################## */ - // If this is an alpine repo change for external version determine an md5 from the version string - stage("Set tag Alpine Repo"){ + // If this is a custom command to determine version use that command + stage("Set tag custom bash"){ steps{ script{ env.EXT_RELEASE = sh( - script: '''curl -sL "${DIST_REPO}x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:'"${DIST_REPO_PACKAGES}"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://' ''', + script: ''' curl -s -L https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/dists/noble/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: firefox' | awk -F ': ' '/Version/{print $2;exit}' | sed 's|[+~,]||g' ''', returnStdout: true).trim() - env.RELEASE_LINK = 'alpine_repo' + env.RELEASE_LINK = 'custom_command' } } } @@ -874,11 +870,11 @@ pipeline { "tagger": {"name": "LinuxServer-CI","email": "ci@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash - echo "Updating external repo packages to ${EXT_RELEASE_CLEAN}" > releasebody.json + echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json echo '{"tag_name":"'${META_TAG}'",\ "target_commitish": "master",\ "name": "'${META_TAG}'",\ - "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Repo Changes:**\\n\\n' > start + "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start printf '","draft": false,"prerelease": false}' >> releasebody.json paste -d'\\0' start releasebody.json > releasebody.json.done curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done''' diff --git a/README.md b/README.md index 95da27c..56173ae 100644 --- a/README.md +++ b/README.md @@ -101,12 +101,43 @@ To install cjk fonts on startup as an example pass the environment variables: ``` -e DOCKER_MODS=linuxserver/mods:universal-package-install --e INSTALL_PACKAGES=font-noto-cjk +-e INSTALL_PACKAGES=fonts-noto-cjk -e LC_ALL=zh_CN.UTF-8 ``` The web interface has the option for "IME Input Mode" in Settings which will allow non english characters to be used from a non en_US keyboard on the client. Once enabled it will perform the same as a local Linux installation set to your locale. +### Nvidia GPU Support + +Nvidia support is available by leveraging Zink for OpenGL support. This can be enabled with the following run flags: + +| Variable | Description | +| :----: | --- | +| --gpus all | This can be filtered down but for most setups this will pass the one Nvidia GPU on the system | +| --runtime nvidia | Specify the Nvidia runtime which mounts drivers and tools in from the host | + +The compose syntax is slightly different for this as you will need to set nvidia as the default runtime: + +``` +sudo nvidia-ctk runtime configure --runtime=docker --set-as-default +sudo service docker restart +``` + +And to assign the GPU in compose: + +``` +services: + webtop: + image: linuxserver/firefox:latest + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [compute,video,graphics,utility] +``` + ### Lossless mode This container is capable of delivering a true lossless image at a high framerate to your web browser by changing the Stream Quality preset to "Lossless", more information [here](https://www.kasmweb.com/docs/latest/how_to/lossless.html#technical-background). In order to use this mode from a non localhost endpoint the HTTPS port on 3001 needs to be used. If using a reverse proxy to port 3000 specific headers will need to be set as outlined [here](https://github.com/linuxserver/docker-baseimage-kasmvnc#lossless). @@ -334,6 +365,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **25.09.24:** - Rebase to Ubuntu Noble. * **23.05.24:** - Rebase to Alpine 3.20. * **13.02.24:** - Add ability to pass CLI args to Firefox. * **10.02.24:** - Update Readme with new env vars and ingest proper PWA icon. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 430483f..1491225 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -2,7 +2,8 @@ # jenkins variables project_name: docker-firefox -external_type: alpine_repo +external_type: na +custom_version_command: "curl -s -L https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/dists/noble/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: firefox' | awk -F ': ' '/Version/{print $2;exit}' | sed 's|[+~,]||g'" release_type: stable release_tag: latest ls_branch: master @@ -15,10 +16,7 @@ repo_vars: - DOCKERHUB_IMAGE = 'linuxserver/firefox' - DEV_DOCKERHUB_IMAGE = 'lsiodev/firefox' - PR_DOCKERHUB_IMAGE = 'lspipepr/firefox' - - DIST_IMAGE = 'alpine' - - DIST_TAG = '3.20' - - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/community/' - - DIST_REPO_PACKAGES = 'firefox' + - DIST_IMAGE = 'ubuntu' - MULTIARCH = 'true' - CI = 'true' - CI_WEB = 'true' diff --git a/readme-vars.yml b/readme-vars.yml index 41af945..0993dd9 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -84,18 +84,50 @@ app_setup_block: | ``` -e DOCKER_MODS=linuxserver/mods:universal-package-install - -e INSTALL_PACKAGES=font-noto-cjk + -e INSTALL_PACKAGES=fonts-noto-cjk -e LC_ALL=zh_CN.UTF-8 ``` The web interface has the option for "IME Input Mode" in Settings which will allow non english characters to be used from a non en_US keyboard on the client. Once enabled it will perform the same as a local Linux installation set to your locale. + ### Nvidia GPU Support + + Nvidia support is available by leveraging Zink for OpenGL support. This can be enabled with the following run flags: + + | Variable | Description | + | :----: | --- | + | --gpus all | This can be filtered down but for most setups this will pass the one Nvidia GPU on the system | + | --runtime nvidia | Specify the Nvidia runtime which mounts drivers and tools in from the host | + + The compose syntax is slightly different for this as you will need to set nvidia as the default runtime: + + ``` + sudo nvidia-ctk runtime configure --runtime=docker --set-as-default + sudo service docker restart + ``` + + And to assign the GPU in compose: + + ``` + services: + webtop: + image: linuxserver/firefox:latest + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [compute,video,graphics,utility] + ``` + ### Lossless mode This container is capable of delivering a true lossless image at a high framerate to your web browser by changing the Stream Quality preset to "Lossless", more information [here](https://www.kasmweb.com/docs/latest/how_to/lossless.html#technical-background). In order to use this mode from a non localhost endpoint the HTTPS port on 3001 needs to be used. If using a reverse proxy to port 3000 specific headers will need to be set as outlined [here](https://github.com/linuxserver/docker-baseimage-kasmvnc#lossless). # changelog changelogs: + - { date: "25.09.24:", desc: "Rebase to Ubuntu Noble." } - { date: "23.05.24:", desc: "Rebase to Alpine 3.20." } - { date: "13.02.24:", desc: "Add ability to pass CLI args to Firefox." } - { date: "10.02.24:", desc: "Update Readme with new env vars and ingest proper PWA icon." } diff --git a/root/etc/apt/preferences.d/firefox-no-snap b/root/etc/apt/preferences.d/firefox-no-snap new file mode 100644 index 0000000..9406bcc --- /dev/null +++ b/root/etc/apt/preferences.d/firefox-no-snap @@ -0,0 +1,3 @@ +Package: firefox* +Pin: release o=Ubuntu* +Pin-Priority: -1 From 511e01b083e807db4ffab6cc26b92c59bdcf69fe Mon Sep 17 00:00:00 2001 From: thelamer Date: Wed, 25 Sep 2024 23:13:48 -0400 Subject: [PATCH 2/2] typo --- README.md | 2 +- readme-vars.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 56173ae..6112532 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ And to assign the GPU in compose: ``` services: - webtop: + firefox: image: linuxserver/firefox:latest deploy: resources: diff --git a/readme-vars.yml b/readme-vars.yml index 0993dd9..aac8aee 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -110,7 +110,7 @@ app_setup_block: | ``` services: - webtop: + firefox: image: linuxserver/firefox:latest deploy: resources: