diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 9ec88d0..ab6dd3c 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,8 +2,8 @@ name: Docker Build on: workflow_dispatch: - push: - branches: [ "main" ] + #push: + # branches: [ "main" ] env: UBUNTU_VERSION: 22.04 @@ -30,19 +30,26 @@ jobs: - name: Env Setter run: | - echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + REPO=${GITHUB_REPOSITORY,,} + echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV} + echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV} - name: Checkout uses: actions/checkout@v3 - name: Permissions fixes run: | - reponame="$(basename ${GITHUB_REPOSITORY})" - target="${HOME}/work/${reponame}/${reponame}/build/COPY*" + target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*" chmod -R ug+rwX ${target} + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -50,14 +57,27 @@ jobs: - name: Set tags run: | - img_path="ghcr.io/${{ env.PACKAGE_NAME }}" - ver_tag="v2-cpu-${{ env.UBUNTU_VERSION }}" + img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}" + img_path_dhub="${{ vars.DOCKERHUB_USER }}/${{ env.REPO_NAME }}-cpu" + if [[ -z ${{ matrix.build.selkies }} || ${{ matrix.build.selkies }} == "latest" ]]; then + SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + else + SELKIES_VERSION=${{ matrix.build.selkies }} + fi + [[ -z $SELKIES_VERSION ]] || { echo "Error: SELKIES_VERSION is empty. Exiting script." >&2; exit 1; } + echo "SELKIES_VERSION=${SELKIES_VERSION}" >> ${GITHUB_ENV} + + base_tag="v2-cpu-${{ env.UBUNTU_VERSION }}" + if [[ ${{ matrix.build.latest }} == "true" ]]; then echo "Marking latest" - TAGS="${img_path}:${base_tag}, ${img_path}:latest-cpu" + # GHCR.io Tags + TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest-cpu" + # Docker.io Tags + TAGS="${TAGS}, ${img_path_dhub}:${SELKIES_VERSION}-ubuntu-${{ env.UBUNTU_VERSION }}, ${img_path_dhub}:latest" else - TAGS="${img_path}:${base_tag}" + TAGS="${img_path_ghcr}:${base_tag}, ${img_path_dhub}:${SELKIES_VERSION}-ubuntu-${{ env.UBUNTU_VERSION }}" fi echo "TAGS=${TAGS}" >> ${GITHUB_ENV} - @@ -92,19 +112,26 @@ jobs: - name: Env Setter run: | - echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + REPO=${GITHUB_REPOSITORY,,} + echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV} + echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV - name: Checkout uses: actions/checkout@v3 - name: Permissions fixes run: | - reponame="$(basename ${GITHUB_REPOSITORY})" - target="${HOME}/work/${reponame}/${reponame}/build/COPY*" + target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*" chmod -R ug+rwX ${target} + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -112,14 +139,27 @@ jobs: - name: Set tags run: | - img_path="ghcr.io/${{ env.PACKAGE_NAME }}" - ver_tag="v2-cuda-${{ matrix.build.cuda }}-${{ env.UBUNTU_VERSION }}" + img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}" + img_path_dhub="${{ vars.DOCKERHUB_USER }}/${{ env.REPO_NAME }}-cuda" + if [[ -z ${{ matrix.build.selkies }} || ${{ matrix.build.selkies }} == "latest" ]]; then + SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + else + SELKIES_VERSION=${{ matrix.build.selkies }} + fi + [[ -z $SELKIES_VERSION ]] || { echo "Error: SELKIES_VERSION is empty. Exiting script." >&2; exit 1; } + echo "SELKIES_VERSION=${SELKIES_VERSION}" >> ${GITHUB_ENV} + + base_tag="v2-cuda-${{ matrix.build.cuda }}-${{ env.UBUNTU_VERSION }}" + if [[ ${{ matrix.build.latest }} == "true" ]]; then echo "Marking latest" - TAGS="${img_path}:${base_tag}, ${img_path}:latest, ${img_path}:latest-cuda" + # GHCR.io Tags + TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:${base_tag}-${SELKIES_VERSION}, ${img_path_ghcr}:latest, ${img_path_ghcr}:latest-cuda" + # Docker.io Tags + TAGS="${TAGS}, ${img_path_dhub}:${SELKIES_VERSION}-${{ matrix.build.cuda }}, ${img_path_dhub}:latest" else - TAGS="${img_path}:${base_tag}" + TAGS="${img_path_ghcr}:${base_tag}-${SELKIES_VERSION}, ${img_path_dhub}:${SELKIES_VERSION}-${{ matrix.build.cuda }} fi echo "TAGS=${TAGS}" >> ${GITHUB_ENV} - @@ -153,19 +193,26 @@ jobs: - name: Env Setter run: | - echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + REPO=${GITHUB_REPOSITORY,,} + echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV} + echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV} - name: Checkout uses: actions/checkout@v3 - name: Permissions fixes run: | - reponame="$(basename ${GITHUB_REPOSITORY})" - target="${HOME}/work/${reponame}/${reponame}/build/COPY*" + target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*" chmod -R ug+rwX ${target} + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -173,14 +220,27 @@ jobs: - name: Set tags run: | - img_path="ghcr.io/${{ env.PACKAGE_NAME }}" - ver_tag="v2-rocm-${{ matrix.build.rocm }}-${{ env.UBUNTU_VERSION }}" + img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}" + img_path_dhub="${{ vars.DOCKERHUB_USER }}/${{ env.REPO_NAME }}-rocm" + if [[ -z ${{ matrix.build.selkies }} || ${{ matrix.build.selkies }} == "latest" ]]; then + SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + else + SELKIES_VERSION=${{ matrix.build.selkies }} + fi + [[ -z $SELKIES_VERSION ]] || { echo "Error: SELKIES_VERSION is empty. Exiting script." >&2; exit 1; } + echo "SELKIES_VERSION=${SELKIES_VERSION}" >> ${GITHUB_ENV} + + base_tag="v2-cuda-${{ matrix.build.rocm }}-${{ env.UBUNTU_VERSION }}" + if [[ ${{ matrix.build.latest }} == "true" ]]; then echo "Marking latest" - TAGS="${img_path}:${base_tag}, ${img_path}:latest-rocm" + # GHCR.io Tags + TAGS="${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:${base_tag}-${SELKIES_VERSION}, ${img_path_ghcr}:latest-rocm" + # Docker.io Tags + TAGS="${TAGS}, ${img_path_dhub}:${SELKIES_VERSION}-${{ matrix.build.rocm }}, ${img_path_dhub}:latest" else - TAGS="${img_path}:${base_tag}" + TAGS="${img_path_ghcr}:${base_tag}-${SELKIES_VERSION}, ${img_path_dhub}:${SELKIES_VERSION}-${{ matrix.build.rocm }} fi echo "TAGS=${TAGS}" >> ${GITHUB_ENV} - diff --git a/README.md b/README.md index d6de6ee..62248b7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ # Linux Desktop -Run a hardware accelerated KDE desktop in a container. This image is heavily influenced by [Selkies Project](https://github.com/selkies-project) to provide an accelerated desktop environment for NVIDIA, AMD and Intel machines. +Run a hardware accelerated KDE desktop in a container. This image is heavily influenced by [Selkies Project](https://github.com/selkies-project) to provide an accelerated desktop environment for NVIDIA, AMD and Intel machines. + +Please see this [important notice](#selkies-notice) from the Selkies development team. ## Documentation @@ -21,12 +23,12 @@ Tags follow these patterns: ##### _CUDA_ - `:cuda-[x.x.x]{-cudnn[x]}-[base|runtime|devel]-[ubuntu-version]` -- `:latest-cuda` → `:cuda-11.8.0-runtime-22.04` +- `:latest-cuda` → `:cuda-12.1.1-cudnn8-runtime-22.04` ##### _ROCm_ - `:rocm-[x.x.x]-[core|runtime|devel]-[ubuntu-version]` -- `:latest-rocm` → `:rocm-5.6-runtime-22.04` +- `:latest-rocm` → `:rocm-6.0-runtime-22.04` ROCm builds are experimental. Please give feedback. @@ -35,7 +37,7 @@ ROCm builds are experimental. Please give feedback. - `:latest-cpu` → `:cpu-22.04` -Browse [here](https://github.com/ai-dock/linux-desktop/pkgs/container/linux-desktop) for an image suitable for your target environment. +Browse [here](https://github.com/ai-dock/linux-desktop/pkgs/container/linux-desktop) for an image suitable for your target environment. Supported Desktop Environments: `KDE Plasma` @@ -49,6 +51,12 @@ Supported Platforms: `NVIDIA CUDA`, `AMD ROCm`, `CPU/iGPU` [linux-desktop:latest](https://link.ai-dock.org/template-vast-linux-desktop) +--- + +## Selkies Notice + +This project has been developed and is supported in part by the National Research Platform (NRP) and the Cognitive Hardware and Software Ecosystem Community Infrastructure (CHASE-CI) at the University of California, San Diego, by funding from the National Science Foundation (NSF), with awards #1730158, #1540112, #1541349, #1826967, #2138811, #2112167, #2100237, and #2120019, as well as additional funding from community partners, infrastructure utilization from the Open Science Grid Consortium, supported by the National Science Foundation (NSF) awards #1836650 and #2030508, and infrastructure utilization from the Chameleon testbed, supported by the National Science Foundation (NSF) awards #1419152, #1743354, and #2027170. This project has also been funded by the Seok-San Yonsei Medical Scientist Training Program (MSTP) Song Yong-Sang Scholarship, College of Medicine, Yonsei University, the MD-PhD/Medical Scientist Training Program (MSTP) through the Korea Health Industry Development Institute (KHIDI), funded by the Ministry of Health & Welfare, Republic of Korea, and the Student Research Bursary of Song-dang Institute for Cancer Research, College of Medicine, Yonsei University. + --- _The author ([@robballantyne](https://github.com/robballantyne)) may be compensated if you sign up to services linked in this document. Testing multiple variants of GPU images in many different environments is both costly and time-consuming; This helps to offset costs_ \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/preflight.d/20-desktop.sh b/build/COPY_ROOT/opt/ai-dock/bin/preflight.d/20-desktop.sh deleted file mode 100755 index 58c5b29..0000000 --- a/build/COPY_ROOT/opt/ai-dock/bin/preflight.d/20-desktop.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/false - -# This file will be sourced in init.sh - -function preflight_main() { - home_dir="/home/${USER_NAME}" - desktop_dir="${home_dir}/Desktop" - mkdir -p ${desktop_dir} - chown ${USER_NAME}.${USER_NAME} "${desktop_dir}" - ln -sf "${home_dir}" "${desktop_dir}" - ln -sf "${WORKSPACE}" "${desktop_dir}" - locale-gen $LANG -} - -preflight_main "$@" \ No newline at end of file diff --git a/build/COPY_ROOT_0/SELKIES-PROJECT_README.md b/build/COPY_ROOT_0/SELKIES-PROJECT_README.md new file mode 100644 index 0000000..70c47fd --- /dev/null +++ b/build/COPY_ROOT_0/SELKIES-PROJECT_README.md @@ -0,0 +1 @@ +This project has been developed and is supported in part by the National Research Platform (NRP) and the Cognitive Hardware and Software Ecosystem Community Infrastructure (CHASE-CI) at the University of California, San Diego, by funding from the National Science Foundation (NSF), with awards #1730158, #1540112, #1541349, #1826967, #2138811, #2112167, #2100237, and #2120019, as well as additional funding from community partners, infrastructure utilization from the Open Science Grid Consortium, supported by the National Science Foundation (NSF) awards #1836650 and #2030508, and infrastructure utilization from the Chameleon testbed, supported by the National Science Foundation (NSF) awards #1419152, #1743354, and #2027170. This project has also been funded by the Seok-San Yonsei Medical Scientist Training Program (MSTP) Song Yong-Sang Scholarship, College of Medicine, Yonsei University, the MD-PhD/Medical Scientist Training Program (MSTP) through the Korea Health Industry Development Institute (KHIDI), funded by the Ministry of Health & Welfare, Republic of Korea, and the Student Research Bursary of Song-dang Institute for Cancer Research, College of Medicine, Yonsei University. \ No newline at end of file diff --git a/build/COPY_ROOT/etc/apt/preferences.d/firefox.pref b/build/COPY_ROOT_0/etc/apt/preferences.d/firefox.pref similarity index 100% rename from build/COPY_ROOT/etc/apt/preferences.d/firefox.pref rename to build/COPY_ROOT_0/etc/apt/preferences.d/firefox.pref diff --git a/build/COPY_ROOT/etc/apt/preferences.d/nosnap.pref b/build/COPY_ROOT_0/etc/apt/preferences.d/nosnap.pref similarity index 100% rename from build/COPY_ROOT/etc/apt/preferences.d/nosnap.pref rename to build/COPY_ROOT_0/etc/apt/preferences.d/nosnap.pref diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/.gitkeep b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/.gitkeep similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/.gitkeep rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/.gitkeep diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/coturn.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/coturn.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/coturn.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/coturn.conf diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/dbus.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/dbus.conf similarity index 73% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/dbus.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/dbus.conf index ea3e8e7..dd28978 100644 --- a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/dbus.conf +++ b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/dbus.conf @@ -1,8 +1,10 @@ [program:dbus] +user=$USER_NAME +environment=PROC_NAME="%(program_name)s",USER=$USER_NAME,HOME=/home/$USER_NAME command=supervisor-dbus.sh process_name=%(program_name)s numprocs=1 -directory=/root +directory=/home/$USER_NAME priority=10 autostart=true startsecs=5 @@ -16,4 +18,4 @@ stdout_logfile=/var/log/supervisor/dbus.log stdout_logfile_maxbytes=10MB stdout_logfile_backups=1 redirect_stderr=true -environment=PROC_NAME="%(program_name)s" + diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/fcitx.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/fcitx.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/fcitx.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/fcitx.conf diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kasmvnc.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kasmvnc.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kasmvnc.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kasmvnc.conf diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kasmxproxy.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kasmxproxy.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kasmxproxy.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kasmxproxy.conf diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kde-plasma.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kde-plasma.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/kde-plasma.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/kde-plasma.conf diff --git a/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire-pulse.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire-pulse.conf new file mode 100644 index 0000000..2c98fc2 --- /dev/null +++ b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire-pulse.conf @@ -0,0 +1,20 @@ +[program:pipewire-pulse] +user=$USER_NAME +environment=PROC_NAME="%(program_name)s",USER=$USER_NAME,HOME=/home/$USER_NAME +command=supervisor-pipewire-pulse.sh +process_name=%(program_name)s +numprocs=1 +directory=/home/$USER_NAME +priority=10 +autostart=true +startsecs=5 +startretries=3 +autorestart=unexpected +stopsignal=TERM +stopwaitsecs=10 +stopasgroup=true +killasgroup=true +stdout_logfile=/var/log/supervisor/pipewire-pulse.log +stdout_logfile_maxbytes=10MB +stdout_logfile_backups=1 +redirect_stderr=true diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/pulseaudio.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire.conf similarity index 53% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/pulseaudio.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire.conf index 519a030..e9d726b 100644 --- a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/pulseaudio.conf +++ b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/pipewire.conf @@ -1,8 +1,10 @@ -[program:pulseaudio] -command=supervisor-pulseaudio.sh +[program:pipewire] +user=$USER_NAME +environment=PROC_NAME="%(program_name)s",USER=$USER_NAME,HOME=/home/$USER_NAME +command=supervisor-pipewire.sh process_name=%(program_name)s numprocs=1 -directory=/root +directory=/home/$USER_NAME priority=10 autostart=true startsecs=5 @@ -12,8 +14,8 @@ stopsignal=TERM stopwaitsecs=10 stopasgroup=true killasgroup=true -stdout_logfile=/var/log/supervisor/pulseaudio.log +stdout_logfile=/var/log/supervisor/pipewire.log stdout_logfile_maxbytes=10MB stdout_logfile_backups=1 redirect_stderr=true -environment=PROC_NAME="%(program_name)s" + diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/selkies-gstreamer.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/selkies-gstreamer.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/selkies-gstreamer.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/selkies-gstreamer.conf diff --git a/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/wireplumber.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/wireplumber.conf new file mode 100644 index 0000000..12f4055 --- /dev/null +++ b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/wireplumber.conf @@ -0,0 +1,21 @@ +[program:wireplumber] +user=$USER_NAME +environment=PROC_NAME="%(program_name)s",USER=$USER_NAME,HOME=/home/$USER_NAME +command=supervisor-wireplumber.sh +process_name=%(program_name)s +numprocs=1 +directory=/home/$USER_NAME +priority=10 +autostart=true +startsecs=5 +startretries=3 +autorestart=unexpected +stopsignal=TERM +stopwaitsecs=10 +stopasgroup=true +killasgroup=true +stdout_logfile=/var/log/supervisor/wireplumber.log +stdout_logfile_maxbytes=10MB +stdout_logfile_backups=1 +redirect_stderr=true + diff --git a/build/COPY_ROOT/etc/supervisor/supervisord/conf.d/x-server.conf b/build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/x-server.conf similarity index 100% rename from build/COPY_ROOT/etc/supervisor/supervisord/conf.d/x-server.conf rename to build/COPY_ROOT_0/etc/supervisor/supervisord/conf.d/x-server.conf diff --git a/build/COPY_ROOT/etc/xdg/kdeglobals b/build/COPY_ROOT_0/etc/xdg/kdeglobals similarity index 100% rename from build/COPY_ROOT/etc/xdg/kdeglobals rename to build/COPY_ROOT_0/etc/xdg/kdeglobals diff --git a/build/COPY_ROOT/etc/xdg/kscreenlockerrc b/build/COPY_ROOT_0/etc/xdg/kscreenlockerrc similarity index 100% rename from build/COPY_ROOT/etc/xdg/kscreenlockerrc rename to build/COPY_ROOT_0/etc/xdg/kscreenlockerrc diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/amd.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/amd.sh similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/amd.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/amd.sh diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/clean.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/clean.sh similarity index 86% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/clean.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/clean.sh index 4ddae39..c1effb9 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/clean.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/clean.sh @@ -2,7 +2,6 @@ # Tidy up and keep image small apt-get clean -y -micromamba clean -ay fix-permissions.sh -o container diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/common.sh similarity index 67% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/common.sh index 4551640..502c2bf 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/common.sh @@ -6,6 +6,7 @@ build_common_main() { add-apt-repository multiverse apt-get update build_common_install_xorg + build_common_install_pipewire build_common_install_virtualgl build_common_install_kde build_common_install_packages @@ -14,6 +15,7 @@ build_common_main() { build_common_install_coturn } + function build_common_install_xorg() { # Minimal xorg installation $APT_INSTALL \ @@ -42,12 +44,15 @@ function build_common_install_xorg() { fonts-opensymbol \ fonts-symbola \ fonts-ubuntu \ + gstreamer1.0-plugins-bad \ + libgstreamer-plugins-bad1.0-dev \ im-config \ lame \ libavcodec-extra \ libdatetime-perl \ libdbus-c++-1-0v5 \ libegl1 \ + libegl-dev \ libegl1:i386 \ libelf-dev \ libgles2 \ @@ -65,6 +70,7 @@ function build_common_install_xorg() { libsm6:i386 \ libva2 \ libva2:i386 \ + libva-dev \ libvulkan-dev \ libvulkan-dev:i386 \ libxcb1 \ @@ -84,14 +90,16 @@ function build_common_install_xorg() { libxvmc1 \ libxtst6 \ libxtst6:i386 \ + libzita-alsa-pcmi0 \ + libzita-resampler1 \ mesa-utils \ mesa-utils-extra \ mesa-vulkan-drivers \ mesa-vulkan-drivers:i386 \ + meson \ net-tools \ ocl-icd-libopencl1 \ packagekit-tools \ - pulseaudio \ python3 \ python3-cups \ ubuntu-drivers-common \ @@ -109,6 +117,7 @@ function build_common_install_xorg() { x11-xkb-utils \ x11-xserver-utils \ x264 \ + x265 \ xauth \ xbitmaps \ xclip \ @@ -120,6 +129,7 @@ function build_common_install_xorg() { xfonts-scalable \ xinit \ xkb-data \ + xsel \ xsettingsd \ xserver-xorg-input-all \ xserver-xorg-input-wacom \ @@ -129,7 +139,37 @@ function build_common_install_xorg() { xvfb } +function build_common_install_pipewire() { + curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xFC43B7352BCC0EC8AF2EEB8B25088A0359807596" \ + | gpg --dearmor -o /etc/apt/trusted.gpg.d/pipewire-debian-ubuntu-pipewire-upstream.gpg + codename=$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"') + echo "deb https://ppa.launchpadcontent.net/pipewire-debian/pipewire-upstream/ubuntu ${codename} main" \ + > "/etc/apt/sources.list.d/pipewire-debian-ubuntu-pipewire-upstream-${codename}.list" + echo "deb https://ppa.launchpadcontent.net/pipewire-debian/wireplumber-upstream/ubuntu ${codename} main" \ + > "/etc/apt/sources.list.d/pipewire-debian-ubuntu-wireplumber-upstream-${codename}.list" + + apt-get update + $APT_INSTALL \ + pipewire \ + pipewire-alsa \ + pipewire-audio-client-libraries \ + pipewire-jack \ + pipewire-locales \ + pipewire-v4l2 \ + pipewire-libcamera \ + gstreamer1.0-pipewire \ + libpipewire-0.3-modules \ + libpipewire-module-x11-bell \ + libspa-0.2-jack \ + libspa-0.2-modules \ + wireplumber \ + wireplumber-locales \ + gir1.2-wp-0.4 +} + function build_common_install_virtualgl() { + export VIRTUALGL_VERSION="$(curl -fsSL "https://api.github.com/repos/VirtualGL/virtualgl/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + env-store VIRTUALGL_VERSION cd /tmp wget "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl_${VIRTUALGL_VERSION}_amd64.deb" wget "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb" @@ -139,15 +179,32 @@ function build_common_install_virtualgl() { /tmp/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb chmod u+s /usr/lib/libvglfaker.so - chmod u+s /usr/lib/libdlfaker.so + chmod u+s /usr/lib/libvglfaker-nodl.so + chmod u+s /usr/lib/libvglfaker-opencl.so + chmod u+s /usr/lib/libdlfaker.so + chmod u+s /usr/lib/libgefaker.so + chmod u+s /usr/lib32/libvglfaker.so + chmod u+s /usr/lib32/libvglfaker-nodl.so + chmod u+s /usr/lib32/libvglfaker-opencl.so chmod u+s /usr/lib32/libdlfaker.so + chmod u+s /usr/lib32/libgefaker.so + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker-nodl.so + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker-opencl.so chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so + chmod u+s /usr/lib/i386-linux-gnu/libgefaker.so } function build_common_install_kasmvnc() { cd /tmp + YQ_VERSION="$(curl -fsSL "https://api.github.com/repos/mikefarah/yq/releases/latest" \ + | jq -r '.tag_name' \ + | sed 's/[^0-9\.\-]*//g')" + curl -o yq -fsSL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_$(dpkg --print-architecture)" + install ./yq /usr/local/bin/ + wget https://github.com/kasmtech/KasmVNC/releases/download/v${KASMVNC_VERSION}/kasmvncserver_jammy_${KASMVNC_VERSION}_amd64.deb $APT_INSTALL \ /tmp/kasmvncserver_jammy_${KASMVNC_VERSION}_amd64.deb @@ -295,50 +352,92 @@ function build_common_install_packages() { function build_common_install_selkies() { # Install latest Selkies-GStreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application, should be consistent with selkies-gstreamer documentation + + # Many duplicates here, but easiest to track selkies package list directly $APT_INSTALL \ python3-pip \ python3-dev \ python3-gi \ python3-setuptools \ python3-wheel \ - libgl-dev \ - libgles-dev \ - libglvnd-dev \ - libgudev-1.0-0 \ - wayland-protocols \ - libwayland-dev \ - libsrtp2-1 \ - libwebrtc-audio-processing1 \ + libaa1 \ + bzip2 \ + libgcrypt20 \ libcairo-gobject2 \ libpangocairo-1.0-0 \ + libgdk-pixbuf2.0-0 \ + libsoup2.4-1 \ + libsoup-gnome2.4-1 \ libgirepository-1.0-1 \ - libjpeg-dev \ - libwebp-dev \ + glib-networking \ + libglib2.0-0 \ + libjson-glib-1.0-0 \ + libgudev-1.0-0 \ + alsa-utils \ + jackd2 \ + libjack-jackd2-0 \ + libpulse0 \ + libogg0 \ + libopus0 \ + libvorbis-dev \ + libjpeg-turbo8 \ + libopenjp2-7 \ libvpx-dev \ - zlib1g-dev \ - i965-va-driver-shaders \ - intel-media-va-driver-non-free \ - intel-gpu-tools \ - radeontop \ - gdebi-core libgdk-pixbuf-xlib-2.0-0 libgdk-pixbuf2.0-0 libsoup-gnome2.4-1 libxdo3 python3-chardet python3-debian xdotool - + libwebp-dev \ + x264 \ + x265 \ + libdrm2 \ + libegl1 \ + libgl1 \ + libopengl0 \ + libgles1 \ + libgles2 \ + libglvnd0 \ + libglx0 \ + wayland-protocols \ + libwayland-dev \ + libwayland-egl1 \ + wmctrl \ + xsel \ + xdotool \ + x11-utils \ + x11-xserver-utils \ + xserver-xorg-core \ + libx11-xcb1 \ + libxcb-dri3-0 \ + libxkbcommon0 \ + libxdamage1 \ + libxfixes3 \ + libxv1 \ + libxtst6 \ + libxext6 + + # > Ubuntu 20.04 + $APT_INSTALL \ + xcvt libopenh264-dev libde265-0 svt-av1 aom-tools + if [[ -z $SELKIES_VERSION || ${SELKIES_VERSION,,} == 'latest' ]]; then - SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" \ + export SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" \ | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + env-store SELKIES_VERSION fi - cd /opt - curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-v${SELKIES_VERSION}-ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"').tgz" | tar -zxf - - - cd /tmp - curl -fsSL -O "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" - pip3 install "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" - - cd /opt - curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz" | tar -zxf - - - cd /tmp - curl -fsSL -o selkies-js-interposer.deb "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-js-interposer-v${SELKIES_VERSION}-ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"').deb" + $APT_INSTALL \ + python3-venv + + python3 -m venv --system-site-packages "$SELKIES_VENV" + + cd /opt + curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/gstreamer-selkies_gpl_v${SELKIES_VERSION}_ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')_$(dpkg --print-architecture).tar.gz" \ + | tar -xzf - + curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web_v${SELKIES_VERSION}.tar.gz" \ + | tar -xzf - + + cd /tmp + curl -O -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" + "$SELKIES_VENV_PIP" install --no-cache-dir --force-reinstall "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" + + curl -o selkies-js-interposer.deb -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-js-interposer_v${SELKIES_VERSION}_ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')_$(dpkg --print-architecture).deb" $APT_INSTALL ./selkies-js-interposer.deb } diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/cpu.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/cpu.sh similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/cpu.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/cpu.sh diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/init.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/init.sh similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/init.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/init.sh diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/nvidia.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/nvidia.sh similarity index 56% rename from build/COPY_ROOT/opt/ai-dock/bin/build/layer0/nvidia.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/nvidia.sh index 3c2a197..cea3430 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/nvidia.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/nvidia.sh @@ -5,6 +5,19 @@ build_nvidia_main() { printf "/usr/local/nvidia/lib\n" >> /etc/ld.so.conf.d/nvidia.conf printf "/usr/local/nvidia/lib64\n" >> /etc/ld.so.conf.d/nvidia.conf + + # Install NVIDIA VAAPI driver + $APT_INSTALL \ + libffmpeg-nvenc-dev + + NVIDIA_VAAPI_DRIVER_VERSION="$(curl -fsSL "https://api.github.com/repos/elFarto/nvidia-vaapi-driver/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" + cd /tmp + curl -fsSL "https://github.com/elFarto/nvidia-vaapi-driver/archive/v${NVIDIA_VAAPI_DRIVER_VERSION}.tar.gz" | tar -xzf - + mv -f nvidia-vaapi-driver* nvidia-vaapi-driver + cd nvidia-vaapi-driver + meson setup build + meson install -C build + # Configure OpenCL manually mkdir -pm755 /etc/OpenCL/vendors printf "libnvidia-opencl.so.1\n" > /etc/OpenCL/vendors/nvidia.icd @@ -13,15 +26,6 @@ build_nvidia_main() { mkdir -pm755 /etc/vulkan/icd.d/ cp /opt/ai-dock/share/vulkan/icd.d/nvidia_icd.json /etc/vulkan/icd.d/ sed -i "s/\$VULKAN_API_VERSION/$VULKAN_API_VERSION/g" /etc/vulkan/icd.d/nvidia_icd.json - - # Extract NVRTC dependency, https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/LICENSE.txt - cd /tmp - curl -fsSL -o nvidia_cuda_nvrtc_linux_x86_64.whl "https://developer.download.nvidia.com/compute/redist/nvidia-cuda-nvrtc/nvidia_cuda_nvrtc-11.0.221-cp36-cp36m-linux_x86_64.whl" - unzip -joq -d ./nvrtc nvidia_cuda_nvrtc_linux_x86_64.whl - cd nvrtc - chmod 755 libnvrtc* - find . -maxdepth 1 -type f -name "*libnvrtc.so.*" -exec sh -c 'ln -snf $(basename {}) libnvrtc.so' \; - mv -f libnvrtc* /opt/gstreamer/lib/x86_64-linux-gnu/ } build_nvidia_main "$@" \ No newline at end of file diff --git a/build/COPY_ROOT_0/opt/ai-dock/bin/preflight.d/20-desktop.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/preflight.d/20-desktop.sh new file mode 100755 index 0000000..53452df --- /dev/null +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/preflight.d/20-desktop.sh @@ -0,0 +1,99 @@ +#!/bin/false + +# This file will be sourced in init.sh + +function preflight_main() { + # Normalize environment variables - Selkies v1.6 improved the naming + # Ensure backwards compatibility with older templates/compose files - We will remove this eventually + sync_vars DISPLAY_SIZEW SIZEW + sync_vars DISPLAY_SIZEW SIZEH + sync_vars DISPLAY_REFRESH REFRESH + sync_vars DISPLAY_DPI DPI + sync_vars DISPLAY_CDEPTH CDEPTH + sync_vars_with_prefixes "SELKIES_" "WEBRTC_" + sync_vars SELKIES_TURN_PROTOCOL TURN_PROTOCOL + sync_vars SELKIES_TURN_PROTOCOL TURN_PROTOCOL + sync_vars SELKIES_TURN_HOST TURN_HOST + sync_vars SELKIES_TURN_PORT TURN_PORT + sync_vars SELKIES_TURN_USERNAME TURN_USERNAME + sync_vars SELKIES_TURN_PASSWORD TURN_PASSWORD + + export DBUS_SOCKET="${XDG_RUNTIME_DIR:-/tmp}/dbus-session-${DISPLAY#*:}" + env-store DBUS_SOCKET + export DBUS_SESSION_BUS_ADDRESS="unix:path=${DBUS_SOCKET}" + env-store DBUS_SESSION_BUS_ADDRESS + export XDG_SESSION_ID="${DISPLAY#*:}" + env-store XDG_SESSION_ID + export PIPEWIRE_RUNTIME_DIR="${PIPEWIRE_RUNTIME_DIR:-${XDG_RUNTIME_DIR:-/tmp}}" + env-store PIPEWIRE_RUNTIME_DIR + export PULSE_RUNTIME_PATH="${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}" + env-store PULSE_RUNTIME_PATH + export PULSE_SERVER="${PULSE_SERVER:-unix:${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}/native}" + env-store PULSE_SERVER + + rm -rf $XDG_RUNTIME_DIR + + home_dir="/home/${USER_NAME}" + desktop_dir="${home_dir}/Desktop" + mkdir -p ${desktop_dir} + chown ${USER_NAME}.${USER_NAME} "${desktop_dir}" + ln -sf "${home_dir}" "${desktop_dir}" + ln -sf "${WORKSPACE}" "${desktop_dir}" + locale-gen $LANG +} + + +function sync_vars() { + local var1_name=$1 + local var2_name=$2 + + # Get the values of the environment variables + local var1_value=$(eval echo "\$$var1_name") + local var2_value=$(eval echo "\$$var2_name") + + # Synchronize the variables + if [ -z "$var1_value" ]; then + export $var1_name="$var2_value" + env-store $var1_name + elif [ -z "$var2_value" ]; then + export $var2_name="$var1_value" + env-store $var2_name + fi +} + +sync_vars_with_prefixes() { + local prefix1=$1 + local prefix2=$2 + + # Iterate over all environment variables matching the given prefixes + for var in $(env | awk -F= '{print $1}' | grep -E "^($prefix1|$prefix2)"); do + if [[ $var == ${prefix1}* ]]; then + # Extract the variable name suffix (e.g., FOO from PREFIX1_FOO) + suffix=${var#$prefix1} + var1_name="${prefix1}${suffix}" + var2_name="${prefix2}${suffix}" + elif [[ $var == ${prefix2}* ]]; then + # Extract the variable name suffix (e.g., FOO from PREFIX2_FOO) + suffix=${var#$prefix2} + var1_name="${prefix1}${suffix}" + var2_name="${prefix2}${suffix}" + fi + + # Get the values of the environment variables + var1_value=$(eval echo "\$$var1_name") + var2_value=$(eval echo "\$$var2_name") + + # Synchronize the variables + if [ -z "$var1_value" ]; then + export $var1_name="$var2_value" + env-store $var1_name + elif [ -z "$var2_value" ]; then + export $var2_name="$var1_value" + env-store $var2_name + fi + done +} + + + +preflight_main "$@" \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-coturn.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-coturn.sh similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-coturn.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-coturn.sh diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-dbus.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-dbus.sh similarity index 67% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-dbus.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-dbus.sh index 54f9888..78c4604 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-dbus.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-dbus.sh @@ -7,8 +7,9 @@ SERVICE_NAME=dbus trap cleanup EXIT function cleanup() { - /etc/init.d/dbus stop + pkill dbus-daemon kill $(jobs -p) > /dev/null 2>&1 + rm -rf "$XDG_RUNTIME_DIR" wait -n } @@ -21,8 +22,11 @@ function start() { fi printf "Starting %s...\n" "$SERVICE_NAME" - - /etc/init.d/dbus start + + mkdir -pm700 "$XDG_RUNTIME_DIR" + chown $(id -u):$(id -u) "$XDG_RUNTIME_DIR" + + dbus-daemon --session --nosyslog --address="$DBUS_SESSION_BUS_ADDRESS" --nofork sleep infinity } diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-fcitx.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-fcitx.sh similarity index 93% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-fcitx.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-fcitx.sh index ba78332..12475e3 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-fcitx.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-fcitx.sh @@ -18,7 +18,7 @@ function start() { printf "Starting ${SERVICE_NAME}...\n" - until [[ -S /run/dbus/system_bus_socket ]]; do + until [[ -S "$DBUS_SOCKET" ]]; do printf "Waiting for dbus socket...\n" sleep 1 done diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmvnc.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmvnc.sh similarity index 78% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmvnc.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmvnc.sh index df9ce13..94cb92c 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmvnc.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmvnc.sh @@ -18,6 +18,8 @@ function cleanup() { # todo improve this function start() { source /opt/ai-dock/etc/environment.sh + source /opt/ai-dock/bin/venv-set.sh serviceportal + if [[ ${SERVERLESS,,} = "true" ]]; then printf "Refusing to start $SERVICE_NAME in serverless mode\n" exec sleep 10 @@ -39,14 +41,14 @@ function start() { fuser -k -SIGKILL ${LISTEN_PORT}/tcp > /dev/null 2>&1 & wait -n - /usr/bin/python3 /opt/ai-dock/fastapi/logviewer/main.py \ + "$SERVICEPORTAL_VENV_PYTHON" /opt/ai-dock/fastapi/logviewer/main.py \ -p $LISTEN_PORT \ -r 5 \ -s "${SERVICE_NAME}" \ -t "Preparing ${SERVICE_NAME}" & fastapi_pid=$! - while [[ -f /run/workspace_sync || -f /run/container_config || ! -S /run/dbus/system_bus_socket || ! -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]]; do + while [[ -f /run/workspace_sync || -f /run/container_config || ! -S "$DBUS_SOCKET" || ! -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]]; do printf "Waiting for X11 and container provisioning...\n" sleep 1 done @@ -55,7 +57,9 @@ function start() { wait -n printf "Starting ${SERVICE_NAME}...\n" + source /opt/ai-dock/etc/environment.sh + sudo cp -f /usr/share/kasmvnc/kasmvnc_defaults.yaml.template \ /usr/share/kasmvnc/kasmvnc_defaults.yaml @@ -63,9 +67,18 @@ function start() { touch /home/${USER_NAME}/.vnc/.de-was-selected printf "%s\n%s\n" "$USER_PASSWORD" "$USER_PASSWORD" | vncpasswd -u $USER_NAME -w "/home/${USER_NAME}/.kasmpasswd" + + echo "" > "$HOME/.vnc/kasmvnc.yaml" + yq -i " + .command_line.prompt = false | + .desktop.allow_resize = false | + .desktop.pixel_depth = ${DISPLAY_CDEPTH} | + .encoding.max_frame_rate = ${DISPLAY_REFRESH} | + " "$HOME/.vnc/kasmvnc.yaml" + #-geometry "${DISPLAY_SIZEW}x${DISPLAY_SIZEH}" \ + vncserver "${VNC_DISPLAY}" \ - -depth "${CDEPTH}" \ - -geometry "${SIZEW}x${SIZEH}" \ + -depth "${DISPLAY_CDEPTH}" \ -fg \ -noxstartup \ -disableBasicAuth \ @@ -73,7 +86,6 @@ function start() { -websocketPort "${LISTEN_PORT}" \ -desktop "VNC Proxy (${DISPLAY} on ${VNC_DISPLAY}" - # -fg is broken sleep infinity } diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmxproxy.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmxproxy.sh similarity index 78% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmxproxy.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmxproxy.sh index d005050..a84e30a 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kasmxproxy.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kasmxproxy.sh @@ -19,13 +19,10 @@ function start() { printf "Waiting for X11 sockets...\n" sleep 1 done - source /opt/ai-dock/etc/environment.sh - if [[ ${WEBRTC_ENABLE_RESIZE,,} == "true" ]]; then - resize_flag="-r" - fi - kasmxproxy -a "${DISPLAY}" -v "${VNC_DISPLAY}" "${resize_flag}" + source /opt/ai-dock/etc/environment.sh + kasmxproxy -a "${DISPLAY}" -v "${VNC_DISPLAY}" } start 2>&1 \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kde-plasma.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kde-plasma.sh similarity index 85% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-kde-plasma.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kde-plasma.sh index 2d4a069..165e803 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-kde-plasma.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-kde-plasma.sh @@ -24,7 +24,7 @@ function start() { printf "Starting ${SERVICE_NAME}...\n" - until [[ -S /run/dbus/system_bus_socket ]]; do + until [[ -S "$DBUS_SOCKET" ]]; do printf "Waiting for dbus socket...\n" sleep 1 done @@ -40,15 +40,18 @@ function start() { # Start KDE # Use VirtualGL to run the KDE desktop environment with OpenGL if the GPU is available, otherwise use OpenGL with llvmpipe xmode="$(cat /tmp/.X-mode)" - + + export QT_LOGGING_RULES='*.debug=false;qt.qpa.*=false' + if [[ $xmode == "proxy" ]]; then + export VGL_FPS="${DISPLAY_REFRESH}" /usr/bin/vglrun \ + -d "${VGL_DISPLAY:-egl}" \ +wm \ /usr/bin/dbus-launch \ /usr/bin/startplasma-x11 else - /usr/bin/dbus-launch \ - /usr/bin/startplasma-x11 + /usr/bin/startplasma-x11 fi } diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-pulseaudio.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire-pulse.sh similarity index 50% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-pulseaudio.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire-pulse.sh index da10162..167b75c 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-pulseaudio.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire-pulse.sh @@ -2,12 +2,11 @@ trap cleanup EXIT -SERVICE_NAME="PulseAudio" +SERVICE_NAME="Pipewire-pulse" function cleanup() { kill $(jobs -p) > /dev/null 2>&1 wait -n - pulseaudio -k } function start() { @@ -19,22 +18,14 @@ function start() { printf "Starting ${SERVICE_NAME}...\n" - if pulseaudio --check >/dev/null 2>&1; then - pulseaudio -k & - wait -n - fi - - until [ -S /run/dbus/system_bus_socket ]; do - printf "Waiting for dbus socket...\n" + until ls ${XDG_RUNTIME_DIR}/pipewire-*.lock >/dev/null 2>&1; do + printf "Waiting for Pipewire lockfile...\n" sleep 1 done + source /opt/ai-dock/etc/environment.sh - - exec pulseaudio \ - --system \ - --realtime=true \ - --disallow-exit \ - -L 'module-native-protocol-tcp auth-ip-acl=127.0.0.0/8 port=4713 auth-anonymous=1' + + /usr/bin/pipewire-pulse } start 2>&1 \ No newline at end of file diff --git a/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire.sh new file mode 100755 index 0000000..74795de --- /dev/null +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-pipewire.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +trap cleanup EXIT + +SERVICE_NAME="Pipewire" + +function cleanup() { + kill $(jobs -p) > /dev/null 2>&1 + wait -n +} + +function start() { + source /opt/ai-dock/etc/environment.sh + if [[ ${SERVERLESS,,} = "true" ]]; then + printf "Refusing to start $SERVICE_NAME in serverless mode\n" + exec sleep 10 + fi + + printf "Starting ${SERVICE_NAME}...\n" + + until [ -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]; do + printf "Waiting for X11 socket...\n" + sleep 1 + done + + source /opt/ai-dock/etc/environment.sh + + /usr/bin/pipewire +} + +start 2>&1 \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh similarity index 58% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh index 6205784..036e36a 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-selkies-gstreamer.sh @@ -2,10 +2,10 @@ trap cleanup EXIT -LISTEN_PORT=${WEBRTC_PORT_LOCAL:-16100} -METRICS_PORT=${WEBRTC_METRICS_PORT:-26100} -PROXY_PORT=${WEBRTC_PORT_HOST:-6100} -SERVICE_URL="${WEBRTC_URL:-}" +LISTEN_PORT=${SELKIES_PORT_LOCAL:-16100} +METRICS_PORT=${SELKIES_METRICS_PORT:-26100} +PROXY_PORT=${SELKIES_PORT_HOST:-6100} +SERVICE_URL="${SELKIES_URL:-}" QUICKTUNNELS=true SERVICE_NAME="KDE Plasma Desktop (WebRTC)" @@ -18,6 +18,8 @@ function cleanup() { # todo improve this function start() { source /opt/ai-dock/etc/environment.sh + source /opt/ai-dock/bin/venv-set.sh serviceportal + source /opt/ai-dock/bin/venv-set.sh selkies if [[ ${SERVERLESS,,} = "true" ]]; then printf "Refusing to start $SERVICE_NAME in serverless mode\n" @@ -40,14 +42,14 @@ function start() { fuser -k -SIGKILL ${LISTEN_PORT}/tcp > /dev/null 2>&1 & wait -n - /usr/bin/python3 /opt/ai-dock/fastapi/logviewer/main.py \ + "$SERVICEPORTAL_VENV_PYTHON" /opt/ai-dock/fastapi/logviewer/main.py \ -p $LISTEN_PORT \ -r 5 \ -s "${SERVICE_NAME}" \ -t "Preparing ${SERVICE_NAME}" & fastapi_pid=$! - while [[ -f /run/workspace_sync || -f /run/container_config || ! -S /run/dbus/system_bus_socket || ! -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]]; do + while [[ -f /run/workspace_sync || -f /run/container_config || ! -S "$DBUS_SOCKET" || ! -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]]; do printf "Waiting for X11 and container provisioning...\n" sleep 1 done @@ -56,46 +58,41 @@ function start() { wait -n printf "Starting ${SERVICE_NAME}...\n" + source /opt/ai-dock/etc/environment.sh + source "$SELKIES_VENV/bin/activate" sudo mkdir -pm755 /dev/input sudo touch /dev/input/{js0,js1,js2,js3} - - export PWA_APP_NAME="AI-Dock Desktop (selkies)" - export PWA_APP_SHORT_NAME="desktop" - export PWA_START_URL="/index.html" - - sed -i \ - -e "s|PWA_APP_NAME|${PWA_APP_NAME}|g" \ - -e "s|PWA_APP_SHORT_NAME|${PWA_APP_SHORT_NAME}|g" \ - -e "s|PWA_START_URL|${PWA_START_URL}|g" \ - /opt/gst-web/manifest.json && \ - sed -i \ - -e "s|PWA_CACHE|${PWA_APP_SHORT_NAME}-webrtc-pwa|g" \ - /opt/gst-web/sw.js # Clear the cache registry rm -rf ~/.cache/gstreamer-1.0 + export GST_DEBUG="${GST_DEBUG:-*:2}" + export GSTREAMER_PATH=/opt/gstreamer + + source "$GSTREAMER_PATH/gst-env" + # Start the selkies-gstreamer WebRTC HTML5 remote desktop application - source /opt/gstreamer/gst-env - selkies-gstreamer-resize ${SIZEW}x${SIZEH} + selkies-gstreamer-resize ${DISPLAY_SIZEW}x${DISPLAY_SIZEH} if [[ ${ENABLE_COTURN,,} == "true" ]]; then - export TURN_HOST="${TURN_HOST:-${EXTERNAL_IP_ADDRESS}}" - export TURN_PORT="${COTURN_PORT_HOST:-3478}" - export TURN_USERNAME="${COTURN_USER:-user}" - export TURN_PASSWORD="${COTURN_PASSWORD:-password}" + export SELKIES_TURN_HOST="${SELKIES_TURN_HOST:-${EXTERNAL_IP_ADDRESS}}" + export SELKIES_TURN_PORT="${COTURN_PORT_HOST:-3478}" + export SELKIES_TURN_USERNAME="${COTURN_USER:-user}" + export SELKIES_TURN_PASSWORD="${COTURN_PASSWORD:-password}" fi - export LD_PRELOAD=/usr/local/lib/selkies-js-interposer/joystick_interposer.so${LD_PRELOAD:+:${LD_PRELOAD}} + export SELKIES_INTERPOSER='/usr/$LIB/selkies_joystick_interposer.so' + export LD_PRELOAD="${SELKIES_INTERPOSER}${LD_PRELOAD:+:${LD_PRELOAD}}" + export LD_LIBRARY_PATH="/opt/gstreamer/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" + export SDL_JOYSTICK_DEVICE=/dev/input/js0 selkies-gstreamer \ --enable_basic_auth=false \ --addr="127.0.0.1" \ - --port="${LISTEN_PORT}" \ - --metrics_port=26105 $WEBRTC_FLAGS + --port="${LISTEN_PORT}" } start 2>&1 \ No newline at end of file diff --git a/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-wireplumber.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-wireplumber.sh new file mode 100755 index 0000000..0a4863a --- /dev/null +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-wireplumber.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +trap cleanup EXIT + +SERVICE_NAME="Wireplumber" + +function cleanup() { + kill $(jobs -p) > /dev/null 2>&1 + wait -n +} + +function start() { + source /opt/ai-dock/etc/environment.sh + if [[ ${SERVERLESS,,} = "true" ]]; then + printf "Refusing to start $SERVICE_NAME in serverless mode\n" + exec sleep 10 + fi + + printf "Starting ${SERVICE_NAME}...\n" + + until ls ${XDG_RUNTIME_DIR}/pipewire-*.lock >/dev/null 2>&1; do + printf "Waiting for Pipewire lockfile...\n" + sleep 1 + done + + source /opt/ai-dock/etc/environment.sh + + /usr/bin/wireplumber +} + +start 2>&1 \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-x-server.sh b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-x-server.sh similarity index 88% rename from build/COPY_ROOT/opt/ai-dock/bin/supervisor-x-server.sh rename to build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-x-server.sh index 8cba656..18a306c 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/supervisor-x-server.sh +++ b/build/COPY_ROOT_0/opt/ai-dock/bin/supervisor-x-server.sh @@ -9,7 +9,7 @@ SERVICE_NAME="X Server" function cleanup() { kill $(jobs -p) > /dev/null 2>&1 & wait -n - sudo rm -rf /tmp/.X* /tmp/runtime-user ~/.cache + sudo rm -rf /tmp/.X* ~/.cache } function start() { @@ -22,15 +22,12 @@ function start() { printf "Starting ${SERVICE_NAME}...\n" - until [[ -S /run/dbus/system_bus_socket ]]; do + until [[ -S "$DBUS_SOCKET" ]]; do printf "Waiting for dbus socket...\n" sleep 1 done cleanup - - sudo mkdir -pm700 /tmp/runtime-user - sudo chown $(id -u):$(id -u) /tmp/runtime-user if [[ $XPU_TARGET == "NVIDIA_GPU" && $(is_nvidia_capable) == "true" && ${ACCEPT_NVIDIA_LICENSE,,} != "false" ]]; then printf "Installing NVIDIA drivers...\n" @@ -75,7 +72,7 @@ function start_nvidia() { # If /dev/dri is not available in te container we will have no HW accel function start_proxy() { echo "proxy" > /tmp/.X-mode - /usr/bin/Xvfb "${DISPLAY}" -ac -screen "0" "8192x4096x${CDEPTH}" -dpi "${DPI}" +extension "RANDR" +extension "GLX" +iglx +extension "MIT-SHM" +render -nolisten "tcp" -noreset -shmem + /usr/bin/Xvfb "${DISPLAY}" -screen 0 "8192x4096x${DISPLAY_CDEPTH}" -dpi "${DISPLAY_DPI}" +extension "COMPOSITE" +extension "DAMAGE" +extension "GLX" +extension "RANDR" +extension "RENDER" +extension "MIT-SHM" +extension "XFIXES" +extension "XTEST" +iglx +render -nolisten "tcp" -ac -noreset -shmem } function is_nvidia_capable() { diff --git a/build/COPY_ROOT/opt/ai-dock/share/syncthing/syncthing.png b/build/COPY_ROOT_0/opt/ai-dock/share/syncthing/syncthing.png similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/share/syncthing/syncthing.png rename to build/COPY_ROOT_0/opt/ai-dock/share/syncthing/syncthing.png diff --git a/build/COPY_ROOT/opt/ai-dock/share/vulkan/icd.d/nvidia_icd.json b/build/COPY_ROOT_0/opt/ai-dock/share/vulkan/icd.d/nvidia_icd.json similarity index 100% rename from build/COPY_ROOT/opt/ai-dock/share/vulkan/icd.d/nvidia_icd.json rename to build/COPY_ROOT_0/opt/ai-dock/share/vulkan/icd.d/nvidia_icd.json diff --git a/build/COPY_ROOT/root/.gitkeep b/build/COPY_ROOT_0/root/.gitkeep similarity index 100% rename from build/COPY_ROOT/root/.gitkeep rename to build/COPY_ROOT_0/root/.gitkeep diff --git a/build/COPY_ROOT/usr/.gitkeep b/build/COPY_ROOT_0/usr/.gitkeep similarity index 100% rename from build/COPY_ROOT/usr/.gitkeep rename to build/COPY_ROOT_0/usr/.gitkeep diff --git a/build/COPY_ROOT/usr/share/applications/syncthing.desktop b/build/COPY_ROOT_0/usr/share/applications/syncthing.desktop similarity index 100% rename from build/COPY_ROOT/usr/share/applications/syncthing.desktop rename to build/COPY_ROOT_0/usr/share/applications/syncthing.desktop diff --git a/build/COPY_ROOT/usr/share/glvnd/egl_vendor.d/10_nvidia.json b/build/COPY_ROOT_0/usr/share/glvnd/egl_vendor.d/10_nvidia.json similarity index 100% rename from build/COPY_ROOT/usr/share/glvnd/egl_vendor.d/10_nvidia.json rename to build/COPY_ROOT_0/usr/share/glvnd/egl_vendor.d/10_nvidia.json diff --git a/build/COPY_ROOT/usr/share/glvnd/egl_vendor.d/50_mesa.json b/build/COPY_ROOT_0/usr/share/glvnd/egl_vendor.d/50_mesa.json similarity index 100% rename from build/COPY_ROOT/usr/share/glvnd/egl_vendor.d/50_mesa.json rename to build/COPY_ROOT_0/usr/share/glvnd/egl_vendor.d/50_mesa.json diff --git a/build/COPY_ROOT/usr/share/kasmvnc/kasmvnc_defaults.yaml.template b/build/COPY_ROOT_0/usr/share/kasmvnc/kasmvnc_defaults.yaml.template similarity index 99% rename from build/COPY_ROOT/usr/share/kasmvnc/kasmvnc_defaults.yaml.template rename to build/COPY_ROOT_0/usr/share/kasmvnc/kasmvnc_defaults.yaml.template index 4858341..e6ecff6 100644 --- a/build/COPY_ROOT/usr/share/kasmvnc/kasmvnc_defaults.yaml.template +++ b/build/COPY_ROOT_0/usr/share/kasmvnc/kasmvnc_defaults.yaml.template @@ -3,7 +3,7 @@ desktop: resolution: width: 1920 height: 1080 - allow_resize: true + allow_resize: false pixel_depth: 24 gpu: hw3d: false diff --git a/build/COPY_ROOT_EXTRA/opt/ai-dock/bin/build/layer1/init.sh b/build/COPY_ROOT_99/opt/ai-dock/bin/build/layer99/init.sh similarity index 82% rename from build/COPY_ROOT_EXTRA/opt/ai-dock/bin/build/layer1/init.sh rename to build/COPY_ROOT_99/opt/ai-dock/bin/build/layer99/init.sh index b9156aa..a4eb060 100755 --- a/build/COPY_ROOT_EXTRA/opt/ai-dock/bin/build/layer1/init.sh +++ b/build/COPY_ROOT_99/opt/ai-dock/bin/build/layer99/init.sh @@ -30,13 +30,20 @@ apt-get install --install-recommends -y \ # Graphics utils apt-get update $APT_INSTALL \ - blender \ - blender-data \ gimp \ inkscape +cd /opt +wget https://ftp.halifax.rwth-aachen.de/blender/release/Blender4.2/blender-4.2.0-linux-x64.tar.xz +tar xvf blender-4.2.0-linux-x64.tar.xz +rm blender-4.2.0-linux-x64.tar.xz +ln -s /opt/blender-4.2.0-linux-x64/blender /opt/ai-dock/bin/blender +cp /opt/blender-4.2.0-linux-x64/blender.desktop /usr/share/applications +cp /opt/blender-4.2.0-linux-x64/blender.svg /usr/share/icons/hicolor/scalable/apps/ + + mkdir -p /opt/krita -wget -O /opt/krita/krita.appimage https://download.kde.org/stable/krita/5.2.2/krita-5.2.2-x86_64.appimage +wget -O /opt/krita/krita.appimage https://download.kde.org/stable/krita/5.2.3/krita-5.2.3-x86_64.appimage chmod +x /opt/krita/krita.appimage (cd /opt/krita && /opt/krita/krita.appimage --appimage-extract) rm -f /opt/krita/krita.appimage @@ -50,6 +57,11 @@ dpkg-divert --add /opt/google/chrome/google-chrome cp -f /opt/google/chrome/google-chrome /opt/google/chrome/google-chrome.distrib cp -f /opt/ai-dock/share/google-chrome/bin/google-chrome /opt/google/chrome/google-chrome +apt-get clean -y + +fix-permissions.sh -o container + rm -rf /tmp/* -fix-permissions -o container \ No newline at end of file +rm /etc/ld.so.cache +ldconfig diff --git a/build/COPY_ROOT_EXTRA/opt/ai-dock/bin/krita b/build/COPY_ROOT_99/opt/ai-dock/bin/krita similarity index 100% rename from build/COPY_ROOT_EXTRA/opt/ai-dock/bin/krita rename to build/COPY_ROOT_99/opt/ai-dock/bin/krita diff --git a/build/COPY_ROOT_EXTRA/opt/ai-dock/share/google-chrome/bin/google-chrome b/build/COPY_ROOT_99/opt/ai-dock/share/google-chrome/bin/google-chrome similarity index 100% rename from build/COPY_ROOT_EXTRA/opt/ai-dock/share/google-chrome/bin/google-chrome rename to build/COPY_ROOT_99/opt/ai-dock/share/google-chrome/bin/google-chrome diff --git a/build/COPY_ROOT_EXTRA/opt/storage/.gitkeep b/build/COPY_ROOT_99/opt/storage/.gitkeep similarity index 100% rename from build/COPY_ROOT_EXTRA/opt/storage/.gitkeep rename to build/COPY_ROOT_99/opt/storage/.gitkeep diff --git a/build/Dockerfile b/build/Dockerfile index 698003d..3dcf56e 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,26 +1,32 @@ # For build automation - Allows building from any ai-dock base image -ARG IMAGE_BASE="ghcr.io/ai-dock/base-image:cuda-11.8.0-runtime-22.04" +ARG IMAGE_BASE="ghcr.io/ai-dock/base-image:v2-cuda-12.1.1-cudnn8-runtime-22.04" FROM ${IMAGE_BASE} LABEL org.opencontainers.image.source https://github.com/ai-dock/linux-desktop -LABEL org.opencontainers.image.description "Docker desktop environment" +LABEL org.opencontainers.image.description "Docker desktop environment with hardware acceleration for NVIDIA, AMD and Intel GPUs" LABEL maintainer="Rob Ballantyne " +ENV SELKIES_VENV=$VENV_DIR/selkies +ENV SELKIES_VENV_PYTHON=$SELKIES_VENV/bin/python +ENV SELKIES_VENV_PIP=$SELKIES_VENV/bin/pip + ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 -ENV USER_GROUPS=${USER_GROUPS},input,lpadmin,pulse-access +ENV USER_GROUPS=${USER_GROUPS},input,lpadmin ENV DISPLAY :0 ENV VNC_DISPLAY :1 ENV XDG_RUNTIME_DIR /tmp/runtime-user -ENV PULSE_SERVER unix:/run/pulse/native -ENV VGL_DISPLAY egl -ARG VIRTUALGL_VERSION=3.1 -ENV VIRTUALGL_VERSION=${VIRTUALGL_VERSION} +ENV PIPEWIRE_LATENCY="32/48000" +# https://forum.manjaro.org/t/howto-troubleshoot-crackling-in-pipewire/82442 +ENV PULSE_LATENCY_MSEC=60 +ENV DISABLE_RTKIT="y" + +ENV VGL_DISPLAY=egl -ARG KASMVNC_VERSION=1.2.0 +ARG KASMVNC_VERSION=1.3.1 ENV KASMVNC_VERSION=${KASMVNC_VERSION} ENV PATH /usr/local/nvidia/bin:/opt/VirtualGL/bin:${PATH} @@ -31,24 +37,25 @@ ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES all ENV __GL_SYNC_TO_VBLANK 0 -# Default environment variables (password is "mypasswd") ENV TZ UTC -ENV SIZEW 1920 -ENV SIZEH 1080 -ENV REFRESH 60 -ENV DPI 96 -ENV CDEPTH 24 -# Hardcoded in x-server init. Users are breaking host machines. Do not use the on vast/runpod!! -#ENV VIDEO_PORT DFP - -ENV WEBRTC_ENCODER nvh264enc -ENV WEBRTC_ENABLE_RESIZE false +ENV DISPLAY_SIZEW 1920 +ENV DISPLAY_SIZEH 1080 +ENV DISPLAY_REFRESH 60 +ENV DISPLAY_DPI 96 +ENV DISPLAY_CDEPTH 24 + +ARG SELKIES_VERSION=1.6.1 +ENV SELKIES_VERSION=${SELKIES_VERSION} +ENV SELKIES_ENCODER nvh264enc +ENV SELKIES_ENABLE_RESIZE false +ENV SELKIES_ENABLE_BASIC_AUTH false ENV XDG_CURRENT_DESKTOP KDE ENV XDG_SESSION_DESKTOP KDE ENV XDG_SESSION_TYPE x11 ENV DESKTOP_SESSION plasma ENV KDE_FULL_SESSION true +ENV KDE_APPLICATIONS_AS_SCOPE=1 ENV KWIN_COMPOSE N ENV KWIN_X11_NO_SYNC_TO_VBLANK 1 ENV SUDO_EDITOR kate @@ -64,7 +71,7 @@ ARG WINE_BRANCH=staging ENV WINE_BRANCH=${WINE_BRANCH} # Copy early so we can use scripts in the build - Changes to these files will invalidate the cache and cause a rebuild. -COPY --chown=0:1111 ./COPY_ROOT/ / +COPY --chown=0:1111 ./COPY_ROOT_0/ / ENV OPT_SYNC=$OPT_SYNC ENV IMAGE_SLUG="linux-desktop" @@ -75,8 +82,8 @@ ENV IMAGE_SLUG="linux-desktop" RUN set -eo pipefail && /opt/ai-dock/bin/build/layer0/init.sh | tee /var/log/build.log # Copy overrides and new files into a final layer for fast rebuilds. Uncomment below -COPY --chown=0:1111 ./COPY_ROOT_EXTRA/ / -RUN set -eo pipefail && /opt/ai-dock/bin/build/layer1/init.sh | tee -a /var/log/build.log +COPY --chown=0:1111 ./COPY_ROOT_99/ / +RUN set -eo pipefail && /opt/ai-dock/bin/build/layer99/init.sh | tee -a /var/log/build.log # Keep init.sh as-is and place additional logic in /opt/ai-dock/bin/preflight.sh CMD ["init.sh"] diff --git a/docker-compose.yaml b/docker-compose.yaml index aff36f8..896e3ef 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,11 +5,12 @@ services: build: context: ./build args: - IMAGE_BASE: ${IMAGE_BASE:-ghcr.io/ai-dock/base-image:cuda-11.8.0-runtime-22.04} + IMAGE_BASE: ${IMAGE_BASE:-ghcr.io/ai-dock/base-image:v2-cuda-12.1.1-cuddn8-runtime-22.04} + SELKIES_VERSION: ${SELKIES_VERSION:-latest} tags: - - "ghcr.io/ai-dock/linux-desktop:${IMAGE_TAG:-cuda-11.8.0-runtime-22.04}" + - "ghcr.io/ai-dock/linux-desktop:${IMAGE_TAG:-v2-cuda-12.1.1-cudnn8-runtime-22.04}" - image: ghcr.io/ai-dock/linux-desktop:${IMAGE_TAG:-cuda-11.8.0-base-22.04} + image: ghcr.io/ai-dock/linux-desktop:${IMAGE_TAG:-v2-cuda-12.1.1-cudnn8-runtime-22.04} shm_size: 2G @@ -44,7 +45,7 @@ services: # Coturn - ${COTURN_PORT_HOST:-3478}:${COTURN_PORT_HOST:-3478} # Selkies - - ${WEBRTC_PORT_HOST:-6100}:${WEBRTC_PORT_HOST:-6100} + - ${SELKIES_PORT_HOST:-6100}:${SELKIES_PORT_HOST:-6100} # VNC - ${VNC_PORT_HOST:-6200}:${VNC_PORT_HOST:-6200} # Syncthing @@ -61,14 +62,16 @@ services: # Auto-generated when empty - COTURN_PASSWORD=${COTURN_PASSWORD:-} # External IP if coturn - - TURN_HOST=${TURN_HOST:-127.0.0.1} - - TURN_PORT=${TURN_PORT:-3478} - - TURN_PROTOCOL=${TURN_PROTOCOL:-tcp} - - TURN_USERNAME=${TURN_USERNAME:-} - - TURN_PASSWORD=${TURN_PASSWORD:-} - - WEBRTC_ENABLE_RESIZE=${WEBRTC_ENABLE_RESIZE:-false} - - WEBRTC_ENCODER=${WEBRTC_ENCODER:-nvh264enc} - - WEBRTC_FLAGS=${WEBRTC_FLAGS:-} + - SELKIES_TURN_HOST=${SELKIES_TURN_HOST:-127.0.0.1} + - SELKIES_TURN_PORT=${SELKIES_TURN_PORT:-3478} + - SELKIES_TURN_PROTOCOL=${SELKIES_TURN_PROTOCOL:-tcp} + - SELKIES_TURN_USERNAME=${SELKIES_TURN_USERNAME:-} + - SELKIES_TURN_PASSWORD=${SELKIES_TURN_PASSWORD:-} + - SELKIES_ENABLE_RESIZE=${SELKIES_ENABLE_RESIZE:-false} + - SELKIES_ENCODER=${SELKIES_ENCODER:-nvh264enc} + - SELKIES_ARGS=${SELKIES_ARGS:-} + - PIPEWIRE_LATENCY=${PIPEWIRE_LATENCY:-32/48000} + - PULSE_LATENCY_MSEC=${PULSE_LATENCY_MSEC:-60} - DIRECT_ADDRESS=${DIRECT_ADDRESS:-127.0.0.1} - DIRECT_ADDRESS_GET_WAN=${DIRECT_ADDRESS_GET_WAN:-false} - WORKSPACE=${WORKSPACE:-/workspace} @@ -86,9 +89,9 @@ services: - VNC_PORT_HOST=${VNC_PORT_HOST:-6200} - VNC_METRICS_PORT=${VNC_METRICS_PORT:-26200} - VNC_URL=${VNC_URL:-} - - WEBRTC_PORT_HOST=${WEBRTC_PORT_HOST:-6100} - - WEBRTC_METRICS_PORT=${WEBRTC_METRICS_PORT:-26100} - - WEBRTC_URL=${WEBRTC_URL:-} + - SELKIES_PORT_HOST=${SELKIES_PORT_HOST:-6100} + - SELKIES_METRICS_PORT=${SELKIES_METRICS_PORT:-26100} + - SELKIES_URL=${SELKIES_URL:-} - SERVERLESS=${SERVERLESS:-false} - SYNCTHING_UI_PORT_HOST=${SYNCTHING_UI_PORT_HOST:-8384} - SYNCTHING_TRANSPORT_PORT_HOST=${SYNCTHING_TRANSPORT_PORT_HOST:-22999}