diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 97d21bb..70ee77e 100644 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -18,7 +18,7 @@ jobs: fi echo "**** External trigger running off of develop branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_KASM_DEVELOP\". ****" echo "**** Retrieving external version ****" - EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases'| jq -r 'map(select(.prerelease)) | sort_by(.published_at) | last | .tag_name') + EXT_RELEASE=$(curl -sX GET https://kasm-ci.s3.amazonaws.com/dev-version.txt) if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "**** Can't retrieve external version, exiting ****" FAILURE_REASON="Can't retrieve external version for kasm branch develop" diff --git a/Dockerfile b/Dockerfile index 407b000..a279b9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.16 +FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy # set version label ARG BUILD_DATE @@ -11,40 +11,46 @@ LABEL maintainer="thelamer" ENV DOCKER_TLS_CERTDIR="" ENV TINI_SUBREAPER=true +#Add needed nvidia environment variables for https://github.com/NVIDIA/nvidia-docker +ENV NVIDIA_DRIVER_CAPABILITIES="compute,graphics,video,utility" + # Container setup RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - alpine-sdk \ - npm && \ echo "**** install packages ****" && \ - apk add --no-cache \ - bash \ + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ + echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable" > \ + /etc/apt/sources.list.d/docker.list && \ + curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \ + gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \ + curl -s -L https://nvidia.github.io/libnvidia-container/ubuntu22.04/libnvidia-container.list | \ + sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ + tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \ + curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt-get install -y --no-install-recommends \ btrfs-progs \ - ca-certificates \ - coreutils \ - curl \ - docker \ - docker-cli-compose \ + containerd.io \ + docker-ce \ + docker-ce-cli \ + docker-compose-plugin \ + drm-info \ e2fsprogs \ - e2fsprogs-extra \ - findutils \ fuse-overlayfs \ - ip6tables \ + g++ \ + gcc \ iptables \ jq \ + make \ nodejs \ + nvidia-docker2 \ openssl \ pigz \ python3 \ - shadow-uidmap \ sudo \ - xfsprogs \ - xz \ - zfs && \ + uidmap \ + xfsprogs && \ echo "**** dind setup ****" && \ - addgroup -S dockremap && \ - adduser -S -G dockremap dockremap && \ + useradd -U dockremap && \ + usermod -G dockremap dockremap && \ echo 'dockremap:165536:65536' >> /etc/subuid && \ echo 'dockremap:165536:65536' >> /etc/subgid && \ curl -o \ @@ -55,8 +61,7 @@ RUN \ echo "**** setup wizard ****" && \ mkdir -p /wizard && \ if [ -z ${KASM_VERSION+x} ]; then \ - KASM_VERSION=$(curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases' \ - | jq -r 'map(select(.prerelease)) | sort_by(.published_at) | last | .tag_name'); \ + KASM_VERSION=$(curl -sX GET https://kasm-ci.s3.amazonaws.com/dev-version.txt); \ fi && \ curl -o \ /tmp/wizard.tar.gz -L \ @@ -75,18 +80,19 @@ RUN \ / && \ echo "**** copy assets ****" && \ cp \ - /kasm_release/www/img/thumbnails/*.png \ + /kasm_release/www/img/thumbnails/*.png /kasm_release/www/img/thumbnails/*.svg \ /wizard/public/img/thumbnails/ && \ cp \ /kasm_release/conf/database/seed_data/default_images_a* \ /wizard/ && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ + apt-get remove -y g++ gcc make && \ + apt-get -y autoremove && \ + apt-get clean && \ rm -rf \ - /root/.npm \ - /root/.cache \ - /tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add init files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 45b2768..49c4fed 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.16 +FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-jammy # set version label ARG BUILD_DATE @@ -11,40 +11,46 @@ LABEL maintainer="thelamer" ENV DOCKER_TLS_CERTDIR="" ENV TINI_SUBREAPER=true +#Add needed nvidia environment variables for https://github.com/NVIDIA/nvidia-docker +ENV NVIDIA_DRIVER_CAPABILITIES="compute,graphics,video,utility" + # Container setup RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - alpine-sdk \ - npm && \ echo "**** install packages ****" && \ - apk add --no-cache \ - bash \ + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ + echo "deb [arch=arm64] https://download.docker.com/linux/ubuntu jammy stable" > \ + /etc/apt/sources.list.d/docker.list && \ + curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \ + gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \ + curl -s -L https://nvidia.github.io/libnvidia-container/ubuntu22.04/libnvidia-container.list | \ + sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ + tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \ + curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt-get install -y --no-install-recommends \ btrfs-progs \ - ca-certificates \ - coreutils \ - curl \ - docker \ - docker-cli-compose \ + containerd.io \ + docker-ce \ + docker-ce-cli \ + docker-compose-plugin \ + drm-info \ e2fsprogs \ - e2fsprogs-extra \ - findutils \ fuse-overlayfs \ - ip6tables \ + g++ \ + gcc \ iptables \ jq \ + make \ nodejs \ + nvidia-docker2 \ openssl \ pigz \ python3 \ - shadow-uidmap \ sudo \ - xfsprogs \ - xz \ - zfs && \ + uidmap \ + xfsprogs && \ echo "**** dind setup ****" && \ - addgroup -S dockremap && \ - adduser -S -G dockremap dockremap && \ + useradd -U dockremap && \ + usermod -G dockremap dockremap && \ echo 'dockremap:165536:65536' >> /etc/subuid && \ echo 'dockremap:165536:65536' >> /etc/subgid && \ curl -o \ @@ -55,8 +61,7 @@ RUN \ echo "**** setup wizard ****" && \ mkdir -p /wizard && \ if [ -z ${KASM_VERSION+x} ]; then \ - KASM_VERSION=$(curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases' \ - | jq -r 'map(select(.prerelease)) | sort_by(.published_at) | last | .tag_name'); \ + KASM_VERSION=$(curl -sX GET https://kasm-ci.s3.amazonaws.com/dev-version.txt); \ fi && \ curl -o \ /tmp/wizard.tar.gz -L \ @@ -75,18 +80,19 @@ RUN \ / && \ echo "**** copy assets ****" && \ cp \ - /kasm_release/www/img/thumbnails/*.png \ + /kasm_release/www/img/thumbnails/*.png /kasm_release/www/img/thumbnails/*.svg \ /wizard/public/img/thumbnails/ && \ cp \ /kasm_release/conf/database/seed_data/default_images_a* \ /wizard/ && \ echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ + apt-get remove -y g++ gcc make && \ + apt-get -y autoremove && \ + apt-get clean && \ rm -rf \ - /root/.npm \ - /root/.cache \ - /tmp/* + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add init files COPY root/ / diff --git a/Jenkinsfile b/Jenkinsfile index 5f188b4..72dcda1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,7 @@ pipeline { DOCKERHUB_IMAGE = 'linuxserver/kasm' DEV_DOCKERHUB_IMAGE = 'lsiodev/kasm' PR_DOCKERHUB_IMAGE = 'lspipepr/kasm' - DIST_IMAGE = 'alpine' + DIST_IMAGE = 'ubuntu' MULTIARCH='true' CI='true' CI_WEB='true' @@ -104,7 +104,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases'| jq -r 'map(select(.prerelease)) | sort_by(.published_at) | last | .tag_name' ''', + script: ''' curl -sX GET https://kasm-ci.s3.amazonaws.com/dev-version.txt ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } diff --git a/README.md b/README.md index 955419b..d5653ac 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,18 @@ Access the installation wizard at https://`your ip`:3000 and follow the instruct Currently Synology systems are not supported due to them blocking CPU scheduling in their Kernel. +### GPU Support + +During installation an option will be presented to force all Workspace containers to mount in and use a specific GPU. If using an NVIDIA GPU you will need to pass `-e NVIDIA_VISIBLE_DEVICES=all` or `--gpus all` and have the [NVIDIA Container Runtime](https://github.com/NVIDIA/nvidia-container-runtime) installed on the host. Also if using NVIDIA, Kasm Workspaces has [native NVIDIA support](https://www.kasmweb.com/docs/latest/how_to/gpu.html) so you can optionally opt to simply use that instead of he manual override during installation. + +### Gamepad support + +In order to properly create virtual Gamepads you will need to mount from your host `/dev/input` and `/run/udev/data`. Please see [HERE](https://www.kasmweb.com/docs/develop/guide/gamepad_passthrough.html) for instructions on enabling gamepad support. + +### Persistant profiles + +In order to use persistant profiles in Workspaces you will need to mount in a folder to use from your host to `/profiles`. From there when configuring a workspace you can set the `Persistant Profile Path` to IE `/profiles/ubuntu-focal/{username}/`, more infomation can be found [HERE](https://www.kasmweb.com/docs/latest/how_to/persistent_profiles.html). + ## Usage Here are some example snippets to help you get started creating a container. @@ -102,6 +114,8 @@ services: volumes: - /path/to/data:/opt - /path/to/profiles:/profiles #optional + - /dev/input:/dev/input #optional + - /run/udev/data:/run/udev/data #optional ports: - 3000:3000 - 443:443 @@ -122,6 +136,8 @@ docker run -d \ -p 443:443 \ -v /path/to/data:/opt \ -v /path/to/profiles:/profiles `#optional` \ + -v /dev/input:/dev/input `#optional` \ + -v /run/udev/data:/run/udev/data `#optional` \ --restart unless-stopped \ lscr.io/linuxserver/kasm:develop ``` @@ -140,6 +156,8 @@ Container images are configured using parameters passed at runtime (such as thos | `-e DOCKER_HUB_PASSWORD=PASS` | Optionally specify a DockerHub password to pull private images. | | `-v /opt` | Docker and installation storage. | | `-v /profiles` | Optionally specify a path for persistent profile storage. | +| `-v /dev/input` | Optional for gamepad support. | +| `-v /run/udev/data` | Optional for gamepad support. | ## Environment variables from files (Docker secrets) @@ -237,5 +255,6 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **05.11.22:** - Rebase to Jammy, add support for GPUs, add support for Gamepads. * **23.09.22:** - Migrate to s6v3. * **02.07.22:** - Initial Release. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 217cb0b..f2949c8 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,7 +3,7 @@ # jenkins variables project_name: docker-kasm external_type: na -custom_version_command: "curl -sX GET 'https://api.github.com/repos/kasmtech/kasm-install-wizard/releases'| jq -r 'map(select(.prerelease)) | sort_by(.published_at) | last | .tag_name'" +custom_version_command: "curl -sX GET https://kasm-ci.s3.amazonaws.com/dev-version.txt" release_type: prerelease release_tag: develop ls_branch: develop @@ -15,7 +15,7 @@ repo_vars: - DOCKERHUB_IMAGE = 'linuxserver/kasm' - DEV_DOCKERHUB_IMAGE = 'lsiodev/kasm' - PR_DOCKERHUB_IMAGE = 'lspipepr/kasm' - - DIST_IMAGE = 'alpine' + - DIST_IMAGE = 'ubuntu' - MULTIARCH='true' - CI='true' - CI_WEB='true' diff --git a/readme-vars.yml b/readme-vars.yml index 1babd09..2e179c8 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -56,6 +56,8 @@ opt_param_env_vars: opt_param_usage_include_vols: true opt_param_volumes: - { vol_path: "/profiles", vol_host_path: "/path/to/profiles", desc: "Optionally specify a path for persistent profile storage." } + - { vol_path: "/dev/input", vol_host_path: "/dev/input", desc: "Optional for gamepad support." } + - { vol_path: "/run/udev/data", vol_host_path: "/run/udev/data", desc: "Optional for gamepad support." } opt_param_usage_include_ports: false opt_param_ports: [] @@ -83,9 +85,22 @@ app_setup_block: | * admin@kasm.local * user@kasm.local - Currently Synology systems are not supported due to them blocking CPU scheduling in their Kernel. + Currently Synology systems are not supported due to them blocking CPU scheduling in their Kernel. + + ### GPU Support + + During installation an option will be presented to force all Workspace containers to mount in and use a specific GPU. If using an NVIDIA GPU you will need to pass `-e NVIDIA_VISIBLE_DEVICES=all` or `--gpus all` and have the [NVIDIA Container Runtime](https://github.com/NVIDIA/nvidia-container-runtime) installed on the host. Also if using NVIDIA, Kasm Workspaces has [native NVIDIA support](https://www.kasmweb.com/docs/latest/how_to/gpu.html) so you can optionally opt to simply use that instead of he manual override during installation. + + ### Gamepad support + + In order to properly create virtual Gamepads you will need to mount from your host `/dev/input` and `/run/udev/data`. Please see [HERE](https://www.kasmweb.com/docs/develop/guide/gamepad_passthrough.html) for instructions on enabling gamepad support. + + ### Persistant profiles + + In order to use persistant profiles in Workspaces you will need to mount in a folder to use from your host to `/profiles`. From there when configuring a workspace you can set the `Persistant Profile Path` to IE `/profiles/ubuntu-focal/{username}/`, more infomation can be found [HERE](https://www.kasmweb.com/docs/latest/how_to/persistent_profiles.html). # changelog changelogs: + - { date: "05.11.22:", desc: "Rebase to Jammy, add support for GPUs, add support for Gamepads." } - { date: "23.09.22:", desc: "Migrate to s6v3." } - { date: "02.07.22:", desc: "Initial Release." } diff --git a/root/gpuinfo.sh b/root/gpuinfo.sh new file mode 100755 index 0000000..984df4e --- /dev/null +++ b/root/gpuinfo.sh @@ -0,0 +1,2 @@ +#! /bin/bash +drm_info -j 2>/dev/null| jq -c 'with_entries(.value |= .driver.desc)'