diff --git a/.github/workflows/docker-bake.hcl b/.github/workflows/docker-bake.hcl index 9cd5212a..27a16aaf 100644 --- a/.github/workflows/docker-bake.hcl +++ b/.github/workflows/docker-bake.hcl @@ -3,14 +3,14 @@ variable "BASE_IMAGE" { } group "default" { - targets = ["runner"] + targets = ["runner-base", "runner-builder"] } target "runner-base" { dockerfile = "containerfiles/runner-base.Containerfile" context = "." args = { - BASE_IMAGE = "${BASE_IMAGE}" + BASE_IMAGE = BASE_IMAGE } cache-from = ["type=gha,scope=runner-base-pr"] cache-to = ["type=gha,scope=runner-base-pr,mode=max"] @@ -30,19 +30,3 @@ target "runner-builder" { runner-base = "target:runner-base" } } - -target "runner" { - dockerfile = "containerfiles/runner.Containerfile" - context = "." - args = { - RUNNER_BASE_IMAGE = "runner-base:latest" - RUNNER_BUILDER_IMAGE = "runner-builder:latest" - } - cache-from = ["type=gha,scope=runner-pr"] - cache-to = ["type=gha,scope=runner-pr,mode=max"] - tags = ["nestri-runner"] - contexts = { - runner-base = "target:runner-base" - runner-builder = "target:runner-builder" - } -} diff --git a/.github/workflows/play-standalone.yml b/.github/workflows/play-standalone.yml new file mode 100644 index 00000000..84b1fc72 --- /dev/null +++ b/.github/workflows/play-standalone.yml @@ -0,0 +1,81 @@ +name: Build Nestri standalone playsite + +on: + pull_request: + paths: + - "containerfiles/playsite.Containerfile" + - ".github/workflows/play-standalone.yml" + - "packages/play-standalone/**" + push: + branches: [ dev, production ] + paths: + - "containerfiles/playsite.Containerfile" + - ".github/workflows/play-standalone.yml" + - "packages/play-standalone/**" + tags: + - v*.*.* + release: + types: [ created ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: nestrilabs/nestri + BASE_TAG_PREFIX: playsite + +jobs: + build-docker-pr: + name: Build image on PR + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + file: containerfiles/playsite.Containerfile + context: ./ + push: false + load: true + tags: nestri:playsite + + build-and-push-docker: + name: Build and push image + if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/production' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Extract Container metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }} + # + #tag on release, and a nightly build for 'dev' + tags: | + type=raw,value=nightly,enable={{is_default_branch}} + type=raw,value={{branch}} + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'production') }} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + file: containerfiles/playsite.Containerfile + context: ./ + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/relay.yml b/.github/workflows/relay.yml index d669a4e3..97eec1cf 100644 --- a/.github/workflows/relay.yml +++ b/.github/workflows/relay.yml @@ -1,6 +1,5 @@ -#Tabs not spaces, you moron :) +name: Build Nestri relay -name: Build nestri:relay on: pull_request: paths: diff --git a/.github/workflows/runner-bases.yml b/.github/workflows/runner-bases.yml new file mode 100644 index 00000000..3be31c1f --- /dev/null +++ b/.github/workflows/runner-bases.yml @@ -0,0 +1,78 @@ +name: Build Nestri runner base images + +on: [ workflow_call ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: nestrilabs/nestri + BASE_IMAGE: docker.io/cachyos/cachyos:latest + +# This makes our release ci quit prematurely +# concurrency: +# group: ci-${{ github.ref }} +# cancel-in-progress: true + +jobs: + build-and-push-bases: + name: Build and push images + if: ${{ github.ref == 'refs/heads/production' || github.ref == 'refs/heads/dev' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + variant: + - { suffix: "", base: "docker.io/cachyos/cachyos:latest" } + - { suffix: "v3", base: "docker.io/cachyos/cachyos-v3:latest" } + #- { suffix: "v4", base: "docker.io/cachyos/cachyos-v4:latest" } # Disabled until GHA has this + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 20 + - name: Build and push runner-base image + uses: docker/build-push-action@v6 + with: + file: containerfiles/runner-base.Containerfile + context: ./ + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest-${{ matrix.variant.suffix }} + build-args: | + BASE_IMAGE=${{ matrix.variant.base }} + cache-from: type=gha,scope=runner-base-${{ matrix.variant.suffix }},mode=max + cache-to: type=gha,scope=runner-base-${{ matrix.variant.suffix }},mode=max + pull: true + - name: Build and push runner-builder image + uses: docker/build-push-action@v6 + with: + file: containerfiles/runner-builder.Containerfile + context: ./ + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-builder:latest-${{ matrix.variant.suffix }} + build-args: | + RUNNER_BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest-${{ matrix.variant.suffix }} + cache-from: type=gha,scope=runner-builder-${{ matrix.variant.suffix }},mode=max + cache-to: type=gha,scope=runner-builder-${{ matrix.variant.suffix }},mode=max + - name: Build and push runner-common image + uses: docker/build-push-action@v6 + with: + file: containerfiles/runner-common.Containerfile + context: ./ + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-common:latest-${{ matrix.variant.suffix }} + build-args: | + RUNNER_BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest-${{ matrix.variant.suffix }} + RUNNER_BUILDER_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-builder:latest-${{ matrix.variant.suffix }} + cache-from: type=gha,scope=runner-common-{{ matrix.variant.suffix }},mode=max + cache-to: type=gha,scope=runner-common-{{ matrix.variant.suffix }},mode=max diff --git a/.github/workflows/runner-variants.yml b/.github/workflows/runner-variants.yml new file mode 100644 index 00000000..937f7499 --- /dev/null +++ b/.github/workflows/runner-variants.yml @@ -0,0 +1,82 @@ +name: Build Nestri runner image variants + +on: + schedule: + - cron: 7 0 * * 1,3,6 # Nightlies + push: + branches: [ dev, production ] + paths: + - "containerfiles/*runner.Containerfile" + - ".github/workflows/runner-variants.yml" + - "packages/scripts/**" + - "packages/configs/**" + tags: + - v*.*.* + release: + types: [ created ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: nestrilabs/nestri + +jobs: + bases: + uses: /.github/workflows/runner-bases.yml + build-and-push-variants: + needs: [ bases ] + name: Build and push images + if: ${{ github.ref == 'refs/heads/production' || github.ref == 'refs/heads/dev' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + variant: + - { suffix: "", base: "docker.io/cachyos/cachyos:latest" } + - { suffix: "v3", base: "docker.io/cachyos/cachyos-v3:latest" } + #- { suffix: "v4", base: "docker.io/cachyos/cachyos-v4:latest" } # Disabled until GHA has this + runner: + - steam + - heroic + - minecraft + # ADD MORE HERE AS NEEDED # + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Extract runner metadata + id: meta-runner + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner + tags: | + type=raw,value=nightly-${{ matrix.runner }}-${{ matrix.variant.suffix }},enable={{is_default_branch}} + type=raw,value={{branch}}-${{ matrix.runner }}-${{ matrix.variant.suffix }} + type=raw,value=latest-${{ matrix.runner }}-${{ matrix.variant.suffix }},enable=${{ github.ref == format('refs/heads/{0}', 'production') }} + type=semver,pattern={{version}}-${{ matrix.runner }}-${{ matrix.variant.suffix }} + type=semver,pattern={{major}}.{{minor}}-${{ matrix.runner }}-${{ matrix.variant.suffix }} + type=semver,pattern={{major}}-${{ matrix.runner }}-${{ matrix.variant.suffix }} + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 20 + - name: Build and push runner image + uses: docker/build-push-action@v6 + with: + file: containerfiles/${{ matrix.runner }}-runner.Containerfile + context: ./ + push: true + tags: ${{ steps.meta-runner.outputs.tags }} + labels: ${{ steps.meta-runner.outputs.labels }} + build-args: | + RUNNER_COMMON_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-common:latest-${{ matrix.variant.suffix }} + cache-from: type=gha,scope=runner-${{ matrix.runner }}-${{ matrix.variant.suffix }},mode=max + cache-to: type=gha,scope=runner-${{ matrix.runner }}-${{ matrix.variant.suffix }},mode=max diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml deleted file mode 100644 index efb4675b..00000000 --- a/.github/workflows/runner.yml +++ /dev/null @@ -1,148 +0,0 @@ -#Tabs not spaces, you moron :) - -name: Build nestri-runner - -on: - pull_request: - paths: - - "containerfiles/runner*.Containerfile" - - "packages/scripts/**" - - "packages/server/**" - - ".github/workflows/runner.yml" - schedule: - - cron: 7 0 * * 1,3,6 # Regularly to keep that build cache warm - push: - branches: [dev, production] - paths: - - "containerfiles/runner*.Containerfile" - - ".github/workflows/runner.yml" - - "packages/scripts/**" - - "packages/server/**" - tags: - - v*.*.* - release: - types: [created] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: nestrilabs/nestri - BASE_IMAGE: docker.io/cachyos/cachyos:latest - -# This makes our release ci quit prematurely -# concurrency: -# group: ci-${{ github.ref }} -# cancel-in-progress: true - -jobs: - build-docker-pr: - name: Build images on PR - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - if: ${{ github.event_name == 'pull_request' }} - steps: - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 20 - - - name: Build images using bake - uses: docker/bake-action@v6 - env: - BASE_IMAGE: ${{ env.BASE_IMAGE }} - with: - files: | - ./.github/workflows/docker-bake.hcl - targets: runner - push: false - load: true - - build-and-push-docker: - name: Build and push images - if: ${{ github.ref == 'refs/heads/production' || github.ref == 'refs/heads/dev' }} - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - strategy: - matrix: - variant: - - { suffix: "", base: "docker.io/cachyos/cachyos:latest" } - - { suffix: "-v3", base: "docker.io/cachyos/cachyos-v3:latest" } - #- { suffix: "-v4", base: "docker.io/cachyos/cachyos-v4:latest" } # Disabled until GHA has this - steps: - - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ github.token }} - - - name: Extract runner metadata - id: meta-runner - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner - tags: | - type=raw,value=nightly${{ matrix.variant.suffix }},enable={{is_default_branch}} - type=raw,value={{branch}}${{ matrix.variant.suffix }} - type=raw,value=latest${{ matrix.variant.suffix }},enable=${{ github.ref == format('refs/heads/{0}', 'production') }} - type=semver,pattern={{version}}${{ matrix.variant.suffix }} - type=semver,pattern={{major}}.{{minor}}${{ matrix.variant.suffix }} - type=semver,pattern={{major}}${{ matrix.variant.suffix }} - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 20 - - - name: Build and push runner-base image - uses: docker/build-push-action@v6 - with: - file: containerfiles/runner-base.Containerfile - context: ./ - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest${{ matrix.variant.suffix }} - build-args: | - BASE_IMAGE=${{ matrix.variant.base }} - cache-from: type=gha,scope=runner-base${{ matrix.variant.suffix }},mode=max - cache-to: type=gha,scope=runner-base${{ matrix.variant.suffix }},mode=max - pull: ${{ github.event_name == 'schedule' }} - - - name: Build and push runner-builder image - uses: docker/build-push-action@v6 - with: - file: containerfiles/runner-builder.Containerfile - context: ./ - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-builder:latest${{ matrix.variant.suffix }} - build-args: | - RUNNER_BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest${{ matrix.variant.suffix }} - cache-from: type=gha,scope=runner-builder${{ matrix.variant.suffix }},mode=max - cache-to: type=gha,scope=runner-builder${{ matrix.variant.suffix }},mode=max - - - name: Build and push runner image - uses: docker/build-push-action@v6 - with: - file: containerfiles/runner.Containerfile - context: ./ - push: true - tags: ${{ steps.meta-runner.outputs.tags }} - labels: ${{ steps.meta-runner.outputs.labels }} - build-args: | - RUNNER_BASE_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-base:latest${{ matrix.variant.suffix }} - RUNNER_BUILDER_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner-builder:latest${{ matrix.variant.suffix }} - cache-from: type=gha,scope=runner${{ matrix.variant.suffix }},mode=max - cache-to: type=gha,scope=runner${{ matrix.variant.suffix }},mode=max diff --git a/containerfiles/heroic-runner.Containerfile b/containerfiles/heroic-runner.Containerfile new file mode 100644 index 00000000..6d54b934 --- /dev/null +++ b/containerfiles/heroic-runner.Containerfile @@ -0,0 +1,23 @@ +# Container build arguments # +ARG RUNNER_COMMON_IMAGE=runner-common:latest + +#*********************# +# Final Runtime Stage # +#*********************# +FROM ${RUNNER_COMMON_IMAGE} + +### FLAVOR/VARIANT CONFIGURATION ### +## HEROIC LAUNCHER ## +RUN --mount=type=cache,target=/var/cache/pacman/pkg \ + pacman -S --noconfirm heroic-games-launcher-bin && \ + # Cleanup + paccache -rk1 && \ + rm -rf /usr/share/{info,man,doc}/* + +## FLAVOR/VARIANT LAUNCH COMMAND ## +ENV NESTRI_LAUNCH_CMD="heroic" +### END OF FLAVOR/VARIANT CONFIGURATION ### + +### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ### +USER root +ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"] diff --git a/containerfiles/minecraft-runner.Containerfile b/containerfiles/minecraft-runner.Containerfile new file mode 100644 index 00000000..51c3e014 --- /dev/null +++ b/containerfiles/minecraft-runner.Containerfile @@ -0,0 +1,24 @@ +# Container build arguments # +ARG RUNNER_COMMON_IMAGE=runner-common:latest + +#*********************# +# Final Runtime Stage # +#*********************# +FROM ${RUNNER_COMMON_IMAGE} + +### FLAVOR/VARIANT CONFIGURATION ### +## MINECRAFT ## +RUN --mount=type=cache,target=/var/cache/pacman/pkg \ + pacman -S --noconfirm paru && \ + sudo -H -u ${NESTRI_USER} paru -S --noconfirm aur/minecraft-launcher && \ + # Cleanup + paccache -rk1 && \ + rm -rf /usr/share/{info,man,doc}/* + +## FLAVOR/VARIANT LAUNCH COMMAND ## +ENV NESTRI_LAUNCH_CMD="minecraft-launcher" +### END OF FLAVOR/VARIANT CONFIGURATION ### + +### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ### +USER root +ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"] diff --git a/containerfiles/runner-builder.Containerfile b/containerfiles/runner-builder.Containerfile index d18d94cd..9b1a799e 100644 --- a/containerfiles/runner-builder.Containerfile +++ b/containerfiles/runner-builder.Containerfile @@ -15,7 +15,7 @@ ENV CARGO_HOME=/usr/local/cargo \ # Install build essentials and caching tools RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --noconfirm rustup git base-devel mold \ + pacman -S --noconfirm rustup git base-devel mold \ meson pkgconf cmake git gcc make # Override various linker with symlink so mold is forcefully used (ld, ld.lld, lld) @@ -38,7 +38,7 @@ WORKDIR /builder # Install build dependencies RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --noconfirm lib32-gcc-libs + pacman -S --noconfirm lib32-gcc-libs # Clone repository RUN git clone --depth 1 --rev "2fde5376b6b9a38cdbd94ccc6a80c9d29a81a417" https://github.com/DatCaptainHorse/vimputti.git @@ -83,7 +83,7 @@ WORKDIR /builder # Install build dependencies RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --noconfirm gst-plugins-good gst-plugin-rswebrtc + pacman -S --noconfirm gst-plugins-good gst-plugin-rswebrtc #-------------------------------------------------------------------- FROM nestri-server-deps AS nestri-server-planner @@ -123,14 +123,14 @@ WORKDIR /builder # Install build dependencies RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --noconfirm libxkbcommon wayland \ + pacman -S --noconfirm libxkbcommon wayland \ gst-plugins-good gst-plugins-bad libinput RUN --mount=type=cache,target=${CARGO_HOME}/registry \ cargo install cargo-c # Clone repository -RUN git clone --depth 1 --rev "a4abcfe2cffe2d33b564d1308b58504a5e3012b1" https://github.com/games-on-whales/gst-wayland-display.git +RUN git clone --depth 1 --rev "dadf6bf3a3a49cc07a0e3d644f48233e29449db4" https://github.com/games-on-whales/gst-wayland-display.git #-------------------------------------------------------------------- FROM gst-wayland-deps AS gst-wayland-planner @@ -168,7 +168,7 @@ WORKDIR /builder # Install build dependencies RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --noconfirm libtool libcap libselinux + pacman -S --noconfirm libtool libcap libselinux # Copy patch file from host COPY packages/patches/bubblewrap/ /builder/patches/ diff --git a/containerfiles/runner.Containerfile b/containerfiles/runner-common.Containerfile similarity index 87% rename from containerfiles/runner.Containerfile rename to containerfiles/runner-common.Containerfile index 7cdc6c4f..56d0431c 100644 --- a/containerfiles/runner.Containerfile +++ b/containerfiles/runner-common.Containerfile @@ -2,9 +2,9 @@ ARG RUNNER_BASE_IMAGE=runner-base:latest ARG RUNNER_BUILDER_IMAGE=runner-builder:latest -#*********************# -# Final Runtime Stage # -#*********************# +#**********************# +# Runtime Common Stage # +#**********************# FROM ${RUNNER_BASE_IMAGE} AS runtime FROM ${RUNNER_BUILDER_IMAGE} AS builder FROM runtime @@ -12,11 +12,11 @@ FROM runtime ### Package Installation ### # Core system components RUN --mount=type=cache,target=/var/cache/pacman/pkg \ - pacman -Sy --needed --noconfirm \ + pacman -S --needed --noconfirm \ vulkan-intel lib32-vulkan-intel vpl-gpu-rt \ vulkan-radeon lib32-vulkan-radeon \ mesa lib32-mesa \ - steam gtk3 lib32-gtk3 \ + gtk3 lib32-gtk3 \ sudo xorg-xwayland seatd libinput gamescope mangohud wlr-randr \ pipewire pipewire-pulse pipewire-alsa wireplumber \ noto-fonts-cjk supervisor jq pacman-contrib \ @@ -67,11 +67,6 @@ RUN mkdir -p /etc/pipewire/pipewire.conf.d && \ COPY packages/configs/wireplumber.conf.d/* /etc/wireplumber/wireplumber.conf.d/ COPY packages/configs/pipewire.conf.d/* /etc/pipewire/pipewire.conf.d/ -## Steam Configs - Proton (Experimental flavor) ## -RUN mkdir -p "${NESTRI_HOME}/.local/share/Steam/config" - -COPY packages/configs/steam/config.vdf "${NESTRI_HOME}/.local/share/Steam/config/" - ## MangoHud Config ## RUN mkdir -p "${NESTRI_HOME}/.config/MangoHud" @@ -93,7 +88,3 @@ RUN chmod +x /etc/nestri/{envs.sh,entrypoint*.sh} && \ setcap cap_net_admin+ep /usr/bin/vimputti-manager && \ dbus-uuidgen > /etc/machine-id && \ LANG=en_US.UTF-8 locale-gen - -# Root for most container engines, nestri-user compatible for apptainer without fakeroot -USER root -ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"] diff --git a/containerfiles/steam-runner.Containerfile b/containerfiles/steam-runner.Containerfile new file mode 100644 index 00000000..4840a0aa --- /dev/null +++ b/containerfiles/steam-runner.Containerfile @@ -0,0 +1,27 @@ +# Container build arguments # +ARG RUNNER_COMMON_IMAGE=runner-common:latest + +#*********************# +# Final Runtime Stage # +#*********************# +FROM ${RUNNER_COMMON_IMAGE} + +### FLAVOR/VARIANT CONFIGURATION ### +## STEAM ## +RUN --mount=type=cache,target=/var/cache/pacman/pkg \ + pacman -S --noconfirm steam && \ + # Cleanup + paccache -rk1 && \ + rm -rf /usr/share/{info,man,doc}/* + +## Steam Configs - Proton (Experimental flavor) ## +RUN mkdir -p "${NESTRI_HOME}/.local/share/Steam/config" +COPY packages/configs/steam/config.vdf "${NESTRI_HOME}/.local/share/Steam/config/" + +## FLAVOR/VARIANT LAUNCH COMMAND ## +ENV NESTRI_LAUNCH_CMD="steam -tenfoot -cef-force-gpu" +### END OF FLAVOR/VARIANT CONFIGURATION ### + +### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ### +USER root +ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"] diff --git a/packages/input/.containerignore b/packages/input/.containerignore new file mode 100644 index 00000000..5a9fb257 --- /dev/null +++ b/packages/input/.containerignore @@ -0,0 +1,3 @@ +.idea/ +dist/ +node_modules/ diff --git a/packages/scripts/entrypoint_nestri.sh b/packages/scripts/entrypoint_nestri.sh index abbb95fd..c55d4eff 100644 --- a/packages/scripts/entrypoint_nestri.sh +++ b/packages/scripts/entrypoint_nestri.sh @@ -106,10 +106,7 @@ start_compositor() { kill_if_running "${COMPOSITOR_PID:-}" "compositor" kill_if_running "${APP_PID:-}" "application" - # Set default values only if variables are unset (not empty) - if [[ -z "${NESTRI_LAUNCH_CMD+x}" ]]; then - NESTRI_LAUNCH_CMD="dbus-launch steam -tenfoot -cef-force-gpu" - fi + # Set default compositor if unset if [[ -z "${NESTRI_LAUNCH_COMPOSITOR+x}" ]]; then NESTRI_LAUNCH_COMPOSITOR="gamescope --backend wayland --force-grab-cursor -g -f --rt --mangoapp -W ${WIDTH} -H ${HEIGHT} -r ${FRAMERATE:-60}" fi @@ -121,6 +118,16 @@ start_compositor() { log "Using LD_PRELOAD shim(s)" fi + # Configure launch cmd with dbus if set + local launch_cmd="" + if [[ -n "${NESTRI_LAUNCH_CMD}" ]]; then + if $do_ld_preload; then + launch_cmd="LD_PRELOAD='/usr/\$LIB/libvimputti_shim.so' dbus-launch $NESTRI_LAUNCH_CMD" + else + launch_cmd="dbus-launch $NESTRI_LAUNCH_CMD" + fi + fi + # Launch compositor if configured if [[ -n "${NESTRI_LAUNCH_COMPOSITOR}" ]]; then local compositor_cmd="$NESTRI_LAUNCH_COMPOSITOR" @@ -129,17 +136,12 @@ start_compositor() { # Check if this is a gamescope command if [[ "$compositor_cmd" == *"gamescope"* ]]; then is_gamescope=true - if [[ -n "$NESTRI_LAUNCH_CMD" ]] && [[ "$compositor_cmd" != *" -- "* ]]; then + if [[ -n "$launch_cmd" ]] && [[ "$compositor_cmd" != *" -- "* ]]; then # If steam in launch command, enable gamescope integration via -e - if [[ "$NESTRI_LAUNCH_CMD" == *"steam"* ]]; then + if [[ "$launch_cmd" == *"steam"* ]]; then compositor_cmd+=" -e" fi - # If ld_preload is true, add env with LD_PRELOAD - if $do_ld_preload; then - compositor_cmd+=" -- env LD_PRELOAD='/usr/\$LIB/libvimputti_shim.so' bash -c $(printf %q "$NESTRI_LAUNCH_CMD")" - else - compositor_cmd+=" -- bash -c $(printf %q "$NESTRI_LAUNCH_CMD")" - fi + compositor_cmd+=" -- bash -c $(printf %q "$launch_cmd")" fi fi @@ -185,9 +187,9 @@ start_compositor() { WAYLAND_DISPLAY=wayland-0 wlr-randr --output "$OUTPUT_NAME" --custom-mode "$WIDTH"x"$HEIGHT" log "Patched resolution with wlr-randr" - if [[ -n "${NESTRI_LAUNCH_CMD}" ]]; then - log "Starting application: $NESTRI_LAUNCH_CMD" - WAYLAND_DISPLAY="$COMPOSITOR_SOCKET" /bin/bash -c "$NESTRI_LAUNCH_CMD" & + if [[ -n "$launch_cmd" ]]; then + log "Starting application: $launch_cmd" + WAYLAND_DISPLAY="$COMPOSITOR_SOCKET" bash -c "$launch_cmd" & APP_PID=$! fi else @@ -200,9 +202,9 @@ start_compositor() { log "Warning: Compositor socket not found after 15 seconds ($COMPOSITOR_SOCKET)" else # Launch standalone application if no compositor - if [[ -n "${NESTRI_LAUNCH_CMD}" ]]; then - log "Starting application: $NESTRI_LAUNCH_CMD" - WAYLAND_DISPLAY=wayland-1 /bin/bash -c "$NESTRI_LAUNCH_CMD" & + if [[ -n "$launch_cmd" ]]; then + log "Starting standalone application: $launch_cmd" + WAYLAND_DISPLAY=wayland-1 bash -c "$launch_cmd" & APP_PID=$! else log "No compositor or application configured"