From 2c7dfe0efe25f4af28191e9635295b4ccc42e40f Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 30 Apr 2022 19:20:16 -0400 Subject: [PATCH 1/6] Add MacOS build --- .github/workflows/CI.yml | 56 ++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 6 ++--- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 236d1602fec..396a58d3cf2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -215,6 +215,62 @@ jobs: last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} + build_mac: + name: MacOS + runs-on: macos-11 + needs: check_changelog + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup Dependencies MacOS + run: | + # install dependencies using homebrew + brew install boost cmake ffmpeg libopusenc + + # fix openssl header not found + cd /usr/local/include + ln -s ../opt/openssl/include/openssl . + + - name: Build MacOS + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets .. + make -j ${nproc} + + - name: Package MacOS + run: | + mkdir -p artifacts + cd build + + # package + cpack -G BUNDLE + cpack -G DMG + + # move + mv Sunshine.bundle ../artifacts/sunshine-macos.bundle + mv Sunshine.dmg ../artifacts/sunshine-macos.dmg + + - name: Upload Artifacts + if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} + uses: actions/upload-artifact@v3 + with: + name: sunshine-macos + path: artifacts/ + + - name: Create Release + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: SunshineStream/actions/create_release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + next_version: ${{ needs.check_changelog.outputs.next_version }} + last_version: ${{ needs.check_changelog.outputs.last_version }} + release_body: ${{ needs.check_changelog.outputs.release_body }} + build_win: name: Windows runs-on: windows-2019 diff --git a/CMakeLists.txt b/CMakeLists.txt index 02a11376123..e745e11187f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,9 +531,9 @@ if(APPLE) # TODO: test RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime) # TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop - # set(CPACK_BUNDLE_NAME "Sunshine") - # set(CPACK_BUNDLE_PLIST "${SUNSHINE_ASSETS_DIR}/info.plist") - # set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") + set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}") + set(CPACK_BUNDLE_PLIST "${SUNSHINE_ASSETS_DIR}/info.plist") + set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") endif() if(UNIX AND NOT APPLE) install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION "${SUNSHINE_CONFIG_DIR}") From 702cc80af703a4f88c03dadda45086141c627384 Mon Sep 17 00:00:00 2001 From: ABeltramo Date: Sun, 1 May 2022 11:32:49 +0100 Subject: [PATCH 2/6] feat: unified docker build, added Dockerfile --- .dockerignore | 11 ++ scripts/Dockerfile-debian => Dockerfile | 35 +++-- scripts/Dockerfile-fedora_33 | 30 ---- scripts/Dockerfile-fedora_35 | 34 ----- scripts/Dockerfile-ubuntu_18_04 | 63 --------- scripts/Dockerfile-ubuntu_20_04 | 46 ------ scripts/Dockerfile-ubuntu_21_04 | 40 ------ scripts/Dockerfile-ubuntu_21_10 | 39 ------ scripts/build-container.sh | 179 ------------------------ scripts/build-private.sh | 48 ------- scripts/build-sunshine.sh | 153 ++++---------------- 11 files changed, 62 insertions(+), 616 deletions(-) create mode 100644 .dockerignore rename scripts/Dockerfile-debian => Dockerfile (51%) delete mode 100644 scripts/Dockerfile-fedora_33 delete mode 100644 scripts/Dockerfile-fedora_35 delete mode 100644 scripts/Dockerfile-ubuntu_18_04 delete mode 100644 scripts/Dockerfile-ubuntu_20_04 delete mode 100644 scripts/Dockerfile-ubuntu_21_04 delete mode 100644 scripts/Dockerfile-ubuntu_21_10 delete mode 100755 scripts/build-container.sh delete mode 100755 scripts/build-private.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..fad61318b5b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +# Remove all, we'll include only the necessary folders via ! +* + +!sunshine +!cmake +!assets +!scripts +!third-party +!CMakeLists.txt +!*.in +!LICENSE \ No newline at end of file diff --git a/scripts/Dockerfile-debian b/Dockerfile similarity index 51% rename from scripts/Dockerfile-debian rename to Dockerfile index fc77eb8e989..18180d11ecb 100644 --- a/scripts/Dockerfile-debian +++ b/Dockerfile @@ -1,6 +1,4 @@ -FROM debian:bullseye AS sunshine-debian - -# Debian Bullseye end of life is TBD +FROM debian:bullseye AS sunshine-build ARG DEBIAN_FRONTEND=noninteractive ARG TZ="Europe/London" @@ -11,7 +9,7 @@ RUN apt-get update -y && \ apt-get install -y \ build-essential \ cmake \ - git \ + rpm \ libavdevice-dev \ libboost-filesystem-dev \ libboost-log-dev \ @@ -31,10 +29,29 @@ RUN apt-get update -y && \ libxrandr-dev \ libxtst-dev \ nvidia-cuda-dev \ - nvidia-cuda-toolkit \ - && apt-get clean \ + nvidia-cuda-toolkit + +ADD . /root/sunshine/ +RUN /root/sunshine/scripts/build-sunshine.sh + +WORKDIR /root/sunshine-build +RUN cpack -G RPM +RUN cpack -G DEB + +################################################# +FROM debian:bullseye-slim AS sunshine + +COPY --from=sunshine-build /root/sunshine-build/Sunshine.deb /Sunshine.deb +COPY --from=sunshine-build /root/sunshine-build/Sunshine.rpm /Sunshine.rpm + +RUN apt-get update -y && \ + apt-get install -y -f /Sunshine.deb \ && rm -rf /var/lib/apt/lists/* -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-deb"] +# Port configuration taken from https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide#manual-port-forwarding-advanced +EXPOSE 47984-47990/tcp +EXPOSE 48010 +EXPOSE 48010/udp +EXPOSE 47998-48000/udp + +ENTRYPOINT ["/usr/bin/sunshine"] diff --git a/scripts/Dockerfile-fedora_33 b/scripts/Dockerfile-fedora_33 deleted file mode 100644 index 136058c3ec7..00000000000 --- a/scripts/Dockerfile-fedora_33 +++ /dev/null @@ -1,30 +0,0 @@ -FROM fedora:33 AS sunshine-fedora_33 - -# Fedora 33 end of life is November 2021 -# This file remains for reference only - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN dnf -y update && \ - dnf -y group install "Development Tools" && \ - dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \ - dnf -y install \ - boost-devel \ - boost-static.x86_64 \ - cmake \ - ffmpeg-devel \ - libevdev-devel \ - libxcb-devel \ - libX11-devel \ - libXfixes-devel \ - libXrandr-devel \ - libXtst-devel \ - openssl-devel \ - opus-devel \ - pulseaudio-libs-devel \ - rpm-build \ - && dnf clean all \ - && rm -rf /var/cache/yum - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-rpm"] diff --git a/scripts/Dockerfile-fedora_35 b/scripts/Dockerfile-fedora_35 deleted file mode 100644 index 18b04377c14..00000000000 --- a/scripts/Dockerfile-fedora_35 +++ /dev/null @@ -1,34 +0,0 @@ -FROM fedora:35 AS sunshine-fedora_35 - -# Fedora 35 end of life is TBD - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN dnf -y update && \ - dnf -y group install "Development Tools" && \ - dnf -y install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \ - dnf -y install \ - boost-devel \ - boost-static.x86_64 \ - cmake \ - ffmpeg-devel \ - gcc-c++ \ - libevdev-devel \ - libX11-devel \ - libxcb-devel \ - libXcursor-devel \ - libXfixes-devel \ - libXinerama-devel \ - libXi-devel \ - libXrandr-devel \ - libXtst-devel \ - mesa-libGL-devel \ - openssl-devel \ - opus-devel \ - pulseaudio-libs-devel \ - rpm-build \ - && dnf clean all \ - && rm -rf /var/cache/yum - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-rpm"] diff --git a/scripts/Dockerfile-ubuntu_18_04 b/scripts/Dockerfile-ubuntu_18_04 deleted file mode 100644 index 6ad3e8c02ad..00000000000 --- a/scripts/Dockerfile-ubuntu_18_04 +++ /dev/null @@ -1,63 +0,0 @@ -FROM ubuntu:18.04 AS sunshine-ubuntu_18_04 - -# Ubuntu 18.04 end of life is April 2028 - -ARG DEBIAN_FRONTEND=noninteractive -ARG TZ="Europe/London" - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update -y && \ - apt-get install -y \ - software-properties-common \ - && add-apt-repository ppa:savoury1/graphics && \ - add-apt-repository ppa:savoury1/multimedia && \ - add-apt-repository ppa:savoury1/ffmpeg4 && \ - add-apt-repository ppa:savoury1/boost-defaults-1.71 && \ - add-apt-repository ppa:ubuntu-toolchain-r/test && \ - apt-get update -y && \ - apt-get install -y \ - build-essential \ - cmake \ - gcc-10 \ - git \ - g++-10 \ - libavdevice-dev \ - libboost-filesystem1.71-dev \ - libboost-log1.71-dev \ - libboost-regex1.71-dev \ - libboost-thread1.71-dev \ - libcap-dev \ - libdrm-dev \ - libevdev-dev \ - libpulse-dev \ - libopus-dev \ - libssl-dev \ - libwayland-dev \ - libx11-dev \ - libxcb-shm0-dev \ - libxcb-xfixes0-dev \ - libxcb1-dev \ - libxfixes-dev \ - libxrandr-dev \ - libxtst-dev \ - wget \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Update gcc alias -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 - -# Install CuDA -RUN wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run && chmod a+x /root/cuda.run -RUN /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm /root/cuda.run - -# Install cmake -ADD https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh /cmake-3.22.2-linux-x86_64.sh -RUN mkdir /opt/cmake -RUN sh /cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license -RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake -RUN cmake --version - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-deb"] diff --git a/scripts/Dockerfile-ubuntu_20_04 b/scripts/Dockerfile-ubuntu_20_04 deleted file mode 100644 index 44e897a7586..00000000000 --- a/scripts/Dockerfile-ubuntu_20_04 +++ /dev/null @@ -1,46 +0,0 @@ -FROM ubuntu:20.04 AS sunshine-ubuntu_20_04 - -# Ubuntu 20.04 end of life is April 2030 - -ARG DEBIAN_FRONTEND=noninteractive -ARG TZ="Europe/London" - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update -y && \ - apt-get install -y \ - build-essential \ - cmake \ - git \ - g++-10 \ - libavdevice-dev \ - libboost-filesystem-dev \ - libboost-log-dev \ - libboost-thread-dev \ - libcap-dev \ - libdrm-dev \ - libevdev-dev \ - libpulse-dev \ - libopus-dev \ - libssl-dev \ - libwayland-dev \ - libx11-dev \ - libxcb-shm0-dev \ - libxcb-xfixes0-dev \ - libxcb1-dev \ - libxfixes-dev \ - libxrandr-dev \ - libxtst-dev \ - wget \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Update gcc alias -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 - -# Install CuDA -RUN wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run && chmod a+x /root/cuda.run -RUN /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && rm /root/cuda.run - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-deb"] diff --git a/scripts/Dockerfile-ubuntu_21_04 b/scripts/Dockerfile-ubuntu_21_04 deleted file mode 100644 index 012845a5b69..00000000000 --- a/scripts/Dockerfile-ubuntu_21_04 +++ /dev/null @@ -1,40 +0,0 @@ -FROM ubuntu:21.04 AS sunshine-ubuntu_21_04 - -# Ubuntu 21.04 end of life is January 2022 -# This file remains for reference only - -ARG DEBIAN_FRONTEND=noninteractive -ARG TZ="Europe/London" - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update -y && \ - apt-get install -y \ - build-essential \ - cmake \ - git \ - libavdevice-dev \ - libboost-thread-dev \ - libboost-filesystem-dev \ - libboost-log-dev \ - libcap-dev \ - libdrm-dev \ - libevdev-dev \ - libpulse-dev \ - libopus-dev \ - libssl-dev \ - libwayland-dev \ - libx11-dev \ - libxcb-shm0-dev \ - libxcb-xfixes0-dev \ - libxcb1-dev \ - libxfixes-dev \ - libxrandr-dev \ - libxtst-dev \ - nvidia-cuda-dev \ - nvidia-cuda-toolkit \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-deb"] diff --git a/scripts/Dockerfile-ubuntu_21_10 b/scripts/Dockerfile-ubuntu_21_10 deleted file mode 100644 index 6be49dbe0cb..00000000000 --- a/scripts/Dockerfile-ubuntu_21_10 +++ /dev/null @@ -1,39 +0,0 @@ -FROM ubuntu:21.10 AS sunshine-ubuntu_21_10 - -# Ubuntu 21.10 end of life is July 2022 - -ARG DEBIAN_FRONTEND=noninteractive -ARG TZ="Europe/London" - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update -y && \ - apt-get install -y \ - build-essential \ - cmake \ - git \ - libavdevice-dev \ - libboost-filesystem-dev \ - libboost-log-dev \ - libboost-thread-dev \ - libcap-dev \ - libdrm-dev \ - libevdev-dev \ - libpulse-dev \ - libopus-dev \ - libssl-dev \ - libwayland-dev \ - libx11-dev \ - libxcb-shm0-dev \ - libxcb-xfixes0-dev \ - libxcb1-dev \ - libxfixes-dev \ - libxrandr-dev \ - libxtst-dev \ - nvidia-cuda-dev \ - nvidia-cuda-toolkit \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Entrypoint -COPY build-private.sh /root/build.sh -ENTRYPOINT ["/root/build.sh", "-deb"] diff --git a/scripts/build-container.sh b/scripts/build-container.sh deleted file mode 100755 index 5da4784aef2..00000000000 --- a/scripts/build-container.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash -e -set -e - -usage() { - echo "Usage: $0 [OPTIONS]" - echo " -c: command --> default [build]" - echo " | delete --> Delete the container, Dockerfile isn't mandatory" - echo " | build --> Build the container, Dockerfile is mandatory" - echo " | compile --> Builds the container, then compiles it. Dockerfile is mandatory" - echo "" - echo " -s: path: The path to the source for compilation" - echo " -n: name: Docker container name --> default [sunshine]" - echo " --> all: Build/Compile/Delete all available docker containers" - echo " -f: Dockerfile: The name of the docker file" -} - -# Attempt to turn relative paths into absolute paths -absolute_path() { - RELATIVE_PATH=$1 - if which realpath >/dev/null 2>/dev/null - then - RELATIVE_PATH=$(realpath $RELATIVE_PATH) - else - echo "Warning: realpath is not installed on your system, ensure [$1] is absolute" - fi - - RETURN=$RELATIVE_PATH -} - -CONTAINER_NAME=sunshine -COMMAND=BUILD - -build_container() { - CONTAINER_NAME=$1 - DOCKER_FILE=$2 - - if [ ! -f "$DOCKER_FILE" ] - then - echo "Error: $DOCKER_FILE doesn't exist" - exit 7 - fi - - echo "docker build . -t $CONTAINER_NAME -f $DOCKER_FILE" - docker build . -t "$CONTAINER_NAME" -f "$DOCKER_FILE" -} - -delete() { - CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') - if [ "$CONTAINER_NAME_UPPER" = "ALL" ] - then - shopt -s nullglob - for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) - do - CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)" - - if docker inspect "$CURRENT_CONTAINER" > /dev/null 2> /dev/null - then - echo "docker rmi $CURRENT_CONTAINER" - docker rmi "$CURRENT_CONTAINER" - fi - done - shopt -u nullglob #revert nullglob back to it's normal default state - else - if docker inspect "$CONTAINER_NAME" > /dev/null 2> /dev/null - then - echo "docker rmi $CONTAINER_NAME" - docker rmi $CONTAINER_NAME - fi - fi -} - -build() { - CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') - if [ "$CONTAINER_NAME_UPPER" = "ALL" ] - then - shopt -s nullglob - for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) - do - CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)" - build_container "$CURRENT_CONTAINER" "$file" - done - shopt -u nullglob #revert nullglob back to it's normal default state - else - if [[ -z "$DOCKER_FILE" ]] - then - echo "Error: if container name isn't equal to 'all', you need to specify the Dockerfile" - exit 6 - fi - - build_container "$CONTAINER_NAME" "$DOCKER_FILE" - fi -} - -abort() { - echo "$1" - exit 10 -} - -compile() { - CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') - if [ "$CONTAINER_NAME_UPPER" = "ALL" ] - then - shopt -s nullglob - - # If any docker container doesn't exist, we cannot compile all of them - for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) - do - CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)" - - # If container doesn't exist --> abort. - docker inspect "$CURRENT_CONTAINER" > /dev/null 2> /dev/null || abort "Error: container image [$CURRENT_CONTAINER] doesn't exist" - done - - for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) - do - CURRENT_CONTAINER="sunshine-$(echo $file | cut -c 14-)" - - echo "$PWD/build-sunshine.sh -p -n $CURRENT_CONTAINER $SUNSHINE_SOURCES" - "$PWD/build-sunshine.sh" -p -n "$CURRENT_CONTAINER" $SUNSHINE_SOURCES - done - shopt -u nullglob #revert nullglob back to it's normal default state - else - # If container exists - if docker inspect "$CONTAINER_NAME" > /dev/null 2> /dev/null - then - echo "$PWD/build-sunshine.sh -p -n $CONTAINER_NAME $SUNSHINE_SOURCES" - "$PWD/build-sunshine.sh" -p -n "$CONTAINER_NAME" $SUNSHINE_SOURCES - else - echo "Error: container image [$CONTAINER_NAME] doesn't exist" - exit 9 - fi - fi -} - -while getopts ":c:hn:f:s:" arg; do - case ${arg} in - s) - SUNSHINE_SOURCES="-s $OPTARG" - ;; - c) - COMMAND=$(echo $OPTARG | tr '[:lower:]' '[:upper:]') - ;; - n) - echo "Container name: $OPTARG" - CONTAINER_NAME="$OPTARG" - ;; - f) - echo "Using Dockerfile [$OPTARG]" - DOCKER_FILE="$OPTARG" - ;; - h) - usage - exit 0 - ;; - esac -done - -echo "$0 set to $(echo $COMMAND | tr '[:upper:]' '[:lower:]')" - -if [ "$COMMAND" = "BUILD" ] -then - echo "Start building..." - delete - build - echo "Done." -elif [ "$COMMAND" = "COMPILE" ] -then - echo "Start compiling..." - compile - echo "Done." -elif [ "$COMMAND" = "DELETE" ] -then - echo "Start deleting..." - delete - echo "Done." -else - echo "Unknown command [$(echo $COMMAND | tr '[:upper:]' '[:lower:]')]" - exit 4 -fi diff --git a/scripts/build-private.sh b/scripts/build-private.sh deleted file mode 100755 index 93d18748899..00000000000 --- a/scripts/build-private.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -e -set -e - -CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" -SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}" -SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR:-/etc/sunshine}" - - -SUNSHINE_ROOT="${SUNSHINE_ROOT:-/root/sunshine}" -SUNSHINE_TAG="${SUNSHINE_TAG:-master}" -SUNSHINE_GIT_URL="${SUNSHINE_GIT_URL:-https://github.com/sunshinestream/sunshine.git}" - - -SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON} -SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON} -SUNSHINE_ENABLE_DRM=${SUNSHINE_ENABLE_DRM:-ON} -SUNSHINE_ENABLE_CUDA=${SUNSHINE_ENABLE_CUDA:-ON} - -# For debugging, it would be usefull to have the sources on the host. -if [[ ! -d "$SUNSHINE_ROOT" ]] -then - git clone --depth 1 --branch "$SUNSHINE_TAG" "$SUNSHINE_GIT_URL" --recurse-submodules "$SUNSHINE_ROOT" -fi - -if [[ ! -d /root/sunshine-build ]] -then - mkdir -p /root/sunshine-build -fi -cd /root/sunshine-build - -cmake "-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" "-DSUNSHINE_EXECUTABLE_PATH=$SUNSHINE_EXECUTABLE_PATH" "-DSUNSHINE_ASSETS_DIR=$SUNSHINE_ASSETS_DIR" "-DSUNSHINE_ENABLE_WAYLAND=$SUNSHINE_ENABLE_WAYLAND" "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" "$SUNSHINE_ROOT" - -make -j ${nproc} - -# Get preferred package format -if [ "$1" == "-rpm" ] -then - echo "Packaging in .rpm format." - ./gen-rpm -d -elif [ "$1" == "-deb" ] -then - echo "Packaging in .deb format." - ./gen-deb -else - echo "Preferred packaging not specified." - echo "Use -deb or -rpm to specify preferred package format." - exit 1 -fi diff --git a/scripts/build-sunshine.sh b/scripts/build-sunshine.sh index 5be8280823d..cce610a9645 100755 --- a/scripts/build-sunshine.sh +++ b/scripts/build-sunshine.sh @@ -1,132 +1,29 @@ #!/bin/bash -e set -e -usage() { - echo "Usage: $0" - echo " -d: Generate a debug build" - echo " -p: Generate a linux package" - echo " -e: Extension of package... i.e. 'deb', 'rpm' --> default [deb]" - echo " -u: The input device is not a TTY" - echo " -n name: Docker container name --> default [sunshine]" - echo " -s path/to/sources/sunshine: Use local sources instead of a git repository" - echo " -c path/to/cmake/binary/dir: Store cmake output on host OS" -} - -# Attempt to turn relative paths into absolute paths -absolute_path() { - RELATIVE_PATH=$1 - if which realpath >/dev/null 2>/dev/null - then - RELATIVE_PATH=$(realpath $RELATIVE_PATH) - else - echo "Warning: realpath is not installed on your system, ensure [$1] is absolute" - fi - - RETURN=$RELATIVE_PATH -} - -CMAKE_BUILD_TYPE="-e CMAKE_BUILD_TYPE=Release" -SUNSHINE_PACKAGE_BUILD=OFF -SUNSHINE_PACKAGE_EXTENSION=deb -SUNSHINE_GIT_URL=https://github.com/sunshinestream/sunshine.git -CONTAINER_NAME=sunshine - -# Docker will fail if ctrl+c is passed through and the input is not a tty -DOCKER_INTERACTIVE=-ti - -while getopts ":dpuhc:e:s:n:" arg; do - case ${arg} in - u) - echo "Input device is not a TTY" - USERNAME="$USER" - unset DOCKER_INTERACTIVE - ;; - d) - echo "Creating debug build" - CMAKE_BUILD_TYPE="-e CMAKE_BUILD_TYPE=Debug" - ;; - p) - echo "Creating package build" - SUNSHINE_PACKAGE_BUILD=ON - SUNSHINE_ASSETS_DIR="-e SUNSHINE_ASSETS_DIR=/etc/sunshine" - SUNSHINE_EXECUTABLE_PATH="-e SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine" - ;; - e) - echo "Defining package extension: $OPTARG" - if [ "$OPTARG" == "deb" ] - then - SUNSHINE_PACKAGE_EXTENSION=$OPTARG - echo "Package extension: deb" - elif [ "$OPTARG" == "rpm" ] - then - SUNSHINE_PACKAGE_EXTENSION=$OPTARG - echo "Package extension: rpm" - else - echo "Package extension not supported: $OPTARG" - echo "Falling back to default package extension: $SUNSHINE_PACKAGE_EXTENSION" - fi - ;; - s) - absolute_path "$OPTARG" - OPTARG="$RETURN" - echo "Using sources from $OPTARG" - SUNSHINE_ROOT="-v $OPTARG:/root/sunshine" - ;; - c) - [ "$USERNAME" == "" ] && USERNAME=$(logname) - - absolute_path "$OPTARG" - OPTARG="$RETURN" - - echo "Using $OPTARG as cmake binary dir" - if [[ ! -d $OPTARG ]] - then - echo "cmake binary dir doesn't exist, a new one will be created." - mkdir -p "$OPTARG" - [ "$USERNAME" == "$USER"] || chown $USERNAME:$USERNAME "$OPTARG" - fi - - CMAKE_ROOT="-v $OPTARG:/root/sunshine-build" - ;; - n) - echo "Container name: $OPTARG" - CONTAINER_NAME=$OPTARG - ;; - h) - usage - exit 0 - ;; - esac -done - -[ "$USERNAME" = "" ] && USERNAME=$(logname) - -BUILD_DIR="$PWD/$CONTAINER_NAME-build" -[ "$SUNSHINE_ASSETS_DIR" = "" ] && SUNSHINE_ASSETS_DIR="-e SUNSHINE_ASSETS_DIR=$BUILD_DIR/assets" -[ "$SUNSHINE_EXECUTABLE_PATH" = "" ] && SUNSHINE_EXECUTABLE_PATH="-e SUNSHINE_EXECUTABLE_PATH=$BUILD_DIR/sunshine" - -echo "docker run $DOCKER_INTERACTIVE --privileged $SUNSHINE_ROOT $CMAKE_ROOT $SUNSHINE_ASSETS_DIR $SUNSHINE_EXECUTABLE_PATH $CMAKE_BUILD_TYPE --name $CONTAINER_NAME $CONTAINER_NAME" -docker run $DOCKER_INTERACTIVE --privileged $SUNSHINE_ROOT $CMAKE_ROOT $SUNSHINE_ASSETS_DIR $SUNSHINE_EXECUTABLE_PATH $CMAKE_BUILD_TYPE --name $CONTAINER_NAME $CONTAINER_NAME - -exit_code=$? - -if [ $exit_code -eq 0 ] -then - mkdir -p $BUILD_DIR - case $SUNSHINE_PACKAGE_BUILD in - ON) - echo "Downloading package to: $BUILD_DIR/$CONTAINER_NAME.$SUNSHINE_PACKAGE_EXTENSION" - docker cp $CONTAINER_NAME:/root/sunshine-build/package-$SUNSHINE_PACKAGE_EXTENSION/sunshine.$SUNSHINE_PACKAGE_EXTENSION "$BUILD_DIR/$CONTAINER_NAME.$SUNSHINE_PACKAGE_EXTENSION" - ;; - *) - echo "Downloading binary and assets to: $BUILD_DIR" - docker cp $CONTAINER_NAME:/root/sunshine/assets "$BUILD_DIR" - docker cp $CONTAINER_NAME:/root/sunshine-build/sunshine "$BUILD_DIR" - ;; - esac - echo "chown --recursive $USERNAME:$USERNAME $BUILD_DIR" - chown --recursive $USERNAME:$USERNAME "$BUILD_DIR" +CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" +SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}" +SUNSHINE_ROOT="${SUNSHINE_ROOT:-/root/sunshine}" +SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine}" + +SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON} +SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON} +SUNSHINE_ENABLE_DRM=${SUNSHINE_ENABLE_DRM:-ON} +SUNSHINE_ENABLE_CUDA=${SUNSHINE_ENABLE_CUDA:-ON} + +if [[ ! -d /root/sunshine-build ]]; then + mkdir -p /root/sunshine-build fi - -echo "Removing docker container $CONTAINER_NAME" -docker rm $CONTAINER_NAME +cd /root/sunshine-build + +cmake \ + "-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" \ + "-DSUNSHINE_EXECUTABLE_PATH=$SUNSHINE_EXECUTABLE_PATH" \ + "-DSUNSHINE_ENABLE_WAYLAND=$SUNSHINE_ENABLE_WAYLAND" \ + "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" \ + "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" \ + "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" \ + "-DSUNSHINE_CONFIG_DIR=$SUNSHINE_CONFIG_DIR" \ + "$SUNSHINE_ROOT" + +make -j ${nproc} From 0913a4994a1a1e7ef09ba62434e47185d6029402 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 12 May 2022 21:55:27 -0400 Subject: [PATCH 3/6] Remove duplicate mac build --- .github/workflows/CI.yml | 56 ---------------------------------------- 1 file changed, 56 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c18e7a5f594..285ef5725e4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -262,62 +262,6 @@ jobs: last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} - build_mac: - name: MacOS - runs-on: macos-11 - needs: check_changelog - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup Dependencies MacOS - run: | - # install dependencies using homebrew - brew install boost cmake ffmpeg libopusenc - - # fix openssl header not found - cd /usr/local/include - ln -s ../opt/openssl/include/openssl . - - - name: Build MacOS - run: | - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets .. - make -j ${nproc} - - - name: Package MacOS - run: | - mkdir -p artifacts - cd build - - # package - cpack -G BUNDLE - cpack -G DMG - - # move - mv Sunshine.bundle ../artifacts/sunshine-macos.bundle - mv Sunshine.dmg ../artifacts/sunshine-macos.dmg - - - name: Upload Artifacts - if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} - uses: actions/upload-artifact@v3 - with: - name: sunshine-macos - path: artifacts/ - - - name: Create Release - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - uses: SunshineStream/actions/create_release@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - next_version: ${{ needs.check_changelog.outputs.next_version }} - last_version: ${{ needs.check_changelog.outputs.last_version }} - release_body: ${{ needs.check_changelog.outputs.release_body }} - build_win: name: Windows runs-on: windows-2019 From 43ecaf1d248c16fd49947c64726627ea813f0d5d Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 10 Aug 2022 21:59:43 -0400 Subject: [PATCH 4/6] update docker build per v0.14.1 requirements --- .dockerignore | 7 ++++--- Dockerfile | 10 +++++----- scripts/build-sunshine.sh | 4 +++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index fad61318b5b..d5f417434e7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,11 +1,12 @@ # Remove all, we'll include only the necessary folders via ! * -!sunshine !cmake -!assets !scripts +!src +!src_assets !third-party !CMakeLists.txt !*.in -!LICENSE \ No newline at end of file +!LICENSE +!NOTICE diff --git a/Dockerfile b/Dockerfile index 18180d11ecb..93f8bfc9ec6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,24 +31,24 @@ RUN apt-get update -y && \ nvidia-cuda-dev \ nvidia-cuda-toolkit -ADD . /root/sunshine/ +COPY . /root/sunshine/ RUN /root/sunshine/scripts/build-sunshine.sh WORKDIR /root/sunshine-build RUN cpack -G RPM -RUN cpack -G DEB +# RUN cpack -G DEB -################################################# FROM debian:bullseye-slim AS sunshine COPY --from=sunshine-build /root/sunshine-build/Sunshine.deb /Sunshine.deb -COPY --from=sunshine-build /root/sunshine-build/Sunshine.rpm /Sunshine.rpm +# COPY --from=sunshine-build /root/sunshine-build/Sunshine.rpm /Sunshine.rpm RUN apt-get update -y && \ apt-get install -y -f /Sunshine.deb \ && rm -rf /var/lib/apt/lists/* -# Port configuration taken from https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide#manual-port-forwarding-advanced +# Port configuration +# https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide#manual-port-forwarding-advanced EXPOSE 47984-47990/tcp EXPOSE 48010 EXPOSE 48010/udp diff --git a/scripts/build-sunshine.sh b/scripts/build-sunshine.sh index cce610a9645..2bc9adbedc5 100755 --- a/scripts/build-sunshine.sh +++ b/scripts/build-sunshine.sh @@ -4,7 +4,8 @@ set -e CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}" SUNSHINE_ROOT="${SUNSHINE_ROOT:-/root/sunshine}" -SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine}" +SUNSHINE_ASSETS_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine/assets}" +SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine/config}" SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON} SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON} @@ -23,6 +24,7 @@ cmake \ "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" \ "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" \ "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" \ + "-DSUNSHINE_ASSETS_DIR=$SUNSHINE_ASSETS_DIR" \ "-DSUNSHINE_CONFIG_DIR=$SUNSHINE_CONFIG_DIR" \ "$SUNSHINE_ROOT" From 78552cc8e9d76f9627e3c62200790b0229cb192f Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 10 Aug 2022 22:09:52 -0400 Subject: [PATCH 5/6] add docker ci --- .docker_platforms | 1 + .github/workflows/ci-docker.yml | 189 ++++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 .docker_platforms create mode 100644 .github/workflows/ci-docker.yml diff --git a/.docker_platforms b/.docker_platforms new file mode 100644 index 00000000000..11a8121d9e8 --- /dev/null +++ b/.docker_platforms @@ -0,0 +1 @@ +linux/amd64 \ No newline at end of file diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml new file mode 100644 index 00000000000..d567d9fe93c --- /dev/null +++ b/.github/workflows/ci-docker.yml @@ -0,0 +1,189 @@ +--- +# This action is centrally managed in https://github.com//.github/ +# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in +# the above-mentioned repo. + +name: CI Docker + +on: + pull_request: + branches: [master, nightly] + types: [opened, synchronize, reopened] + push: + branches: [master, nightly] + workflow_dispatch: + +jobs: + check_dockerfile: + name: Check Dockerfile + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Check + id: check + run: | + if [ -f "./Dockerfile" ] + then + FOUND=true + else + FOUND=false + fi + + echo "::set-output name=dockerfile::${FOUND}" + + outputs: + dockerfile: ${{ steps.check.outputs.dockerfile }} + + lint_dockerfile: + name: Lint Dockerfile + needs: [check_dockerfile] + if: ${{ needs.check_dockerfile.outputs.dockerfile == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Lint Dockerfile + uses: actions/checkout@v3 + + - uses: hadolint/hadolint-action@v2.1.0 + with: + dockerfile: ./Dockerfile + + check_changelog: + name: Check Changelog + needs: [check_dockerfile] + if: ${{ needs.check_dockerfile.outputs.dockerfile == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} + uses: actions/checkout@v3 + + - name: Verify Changelog + id: verify_changelog + if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} + # base_ref for pull request check, ref for push + uses: LizardByte/.github/actions/verify_changelog@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + outputs: + next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }} + + docker: + name: Docker + needs: [check_dockerfile, check_changelog] + if: ${{ needs.check_dockerfile.outputs.dockerfile == 'true' }} + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Prepare + id: prepare + env: + NEXT_VERSION: ${{ needs.check_changelog.outputs.next_version }} + run: | + # get branch name + BRANCH=${GITHUB_HEAD_REF} + + if [ -z "$BRANCH" ] + then + echo "This is a PUSH event" + BRANCH=${{ github.ref_name }} + fi + + # determine to push image to dockerhub and ghcr or not + if [[ $GITHUB_EVENT_NAME == "push" ]]; then + PUSH=true + else + PUSH=false + fi + + # setup the tags + REPOSITORY=${{ github.repository }} + BASE_TAG=$(echo $REPOSITORY | tr '[:upper:]' '[:lower:]') + COMMIT=${{ github.sha }} + + TAGS="${BASE_TAG}:${COMMIT:0:7},ghcr.io/${BASE_TAG}:${COMMIT:0:7}" + + if [[ $GITHUB_REF == refs/heads/master ]]; then + TAGS="${TAGS},${BASE_TAG}:latest,ghcr.io/${BASE_TAG}:latest" + TAGS="${TAGS},${BASE_TAG}:master,ghcr.io/${BASE_TAG}:master" + elif [[ $GITHUB_REF == refs/heads/nightly ]]; then + TAGS="${TAGS},${BASE_TAG}:nightly,ghcr.io/${BASE_TAG}:nightly" + else + TAGS="${TAGS},${BASE_TAG}:test,ghcr.io/${BASE_TAG}:test" + fi + + if [[ ${NEXT_VERSION} != "" ]]; then + TAGS="${TAGS},${BASE_TAG}:${NEXT_VERSION},ghcr.io/${BASE_TAG}:${NEXT_VERSION}" + fi + + # read the platforms from `.docker_platforms` + PLATFORMS=$(<.docker_platforms) + + echo ::set-output name=branch::${BRANCH} + echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ') + echo ::set-output name=commit::${COMMIT} + echo ::set-output name=platforms::${PLATFORMS} + echo ::set-output name=push::${PUSH} + echo ::set-output name=tags::${TAGS} + + - name: Set Up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + id: buildx + + - name: Cache Docker Layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + if: ${{ steps.prepare.outputs.push == 'true' }} # PRs do not have access to secrets + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Log in to the Container registry + if: ${{ steps.prepare.outputs.push == 'true' }} # PRs do not have access to secrets + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ secrets.GH_BOT_NAME }} + password: ${{ secrets.GH_BOT_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: ./ + file: ./Dockerfile + push: ${{ steps.prepare.outputs.push }} + platforms: ${{ steps.prepare.outputs.platforms }} + build-args: | + BRANCH=${{ steps.prepare.outputs.branch }} + COMMIT=${{ steps.prepare.outputs.commit }} + BUILD_DATE=${{ steps.prepare.outputs.build_date }} + tags: ${{ steps.prepare.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Update Docker Hub Description + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} # token is not currently supported + repository: ${{ env.BASE_TAG }} + short-description: ${{ github.event.repository.description }} + readme-filepath: ./DOCKER_README.md From e1d56ba4e7912996a4766a77af33f543af5820da Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 10 Aug 2022 22:26:38 -0400 Subject: [PATCH 6/6] fix build --- .github/workflows/CI.yml | 2 +- .github/workflows/ci-docker.yml | 2 ++ Dockerfile | 32 ++++++++++++++++++++++++++------ scripts/build-sunshine.sh | 6 ++++-- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c9e6b0df0e6..dcac262c30c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -73,7 +73,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Dependencies Linux AUR run: | diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index d567d9fe93c..ed36038d1ed 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -81,6 +81,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + submodules: recursive - name: Prepare id: prepare diff --git a/Dockerfile b/Dockerfile index 93f8bfc9ec6..1ed74b8ca6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG TZ="Europe/London" SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN echo deb http://deb.debian.org/debian/ bullseye main contrib non-free | tee /etc/apt/sources.list.d/non-free.list RUN apt-get update -y && \ - apt-get install -y \ + apt-get install --no-install-recommends -y \ build-essential \ cmake \ rpm \ @@ -31,12 +31,32 @@ RUN apt-get update -y && \ nvidia-cuda-dev \ nvidia-cuda-toolkit -COPY . /root/sunshine/ -RUN /root/sunshine/scripts/build-sunshine.sh +RUN mkdir /root/sunshine +WORKDIR /root/sunshine + +COPY ./* . +RUN mkdir /root/sunshine-build + +# RUN /root/sunshine/scripts/build-sunshine.sh WORKDIR /root/sunshine-build -RUN cpack -G RPM -# RUN cpack -G DEB + +RUN cmake \ + "-DCMAKE_BUILD_TYPE=Release" \ + "-DCMAKE_INSTALL_PREFIX=/etc" \ + "-DSUNSHINE_ASSETS_DIR=sunshine/assets" \ + "-DSUNSHINE_CONFIG_DIR=sunshine/config" \ + "-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine" \ + "-DSUNSHINE_ENABLE_WAYLAND=ON" \ + "-DSUNSHINE_ENABLE_X11=ON" \ + "-DSUNSHINE_ENABLE_DRM=ON" \ + "-DSUNSHINE_ENABLE_CUDA=ON" \ + "/root/sunshine" + +RUN make -j ${nproc} + +RUN cpack -G DEB +# RUN cpack -G RPM FROM debian:bullseye-slim AS sunshine @@ -44,7 +64,7 @@ COPY --from=sunshine-build /root/sunshine-build/Sunshine.deb /Sunshine.deb # COPY --from=sunshine-build /root/sunshine-build/Sunshine.rpm /Sunshine.rpm RUN apt-get update -y && \ - apt-get install -y -f /Sunshine.deb \ + apt-get install --no-install-recommends -y -f /Sunshine.deb \ && rm -rf /var/lib/apt/lists/* # Port configuration diff --git a/scripts/build-sunshine.sh b/scripts/build-sunshine.sh index 2bc9adbedc5..a815b332f4e 100755 --- a/scripts/build-sunshine.sh +++ b/scripts/build-sunshine.sh @@ -4,8 +4,9 @@ set -e CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}" SUNSHINE_ROOT="${SUNSHINE_ROOT:-/root/sunshine}" -SUNSHINE_ASSETS_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine/assets}" -SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR:-/etc/sunshine/config}" +CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX:-/etc}" +SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR:-sunshine/assets}" +SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR:-sunshine/config}" SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON} SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON} @@ -24,6 +25,7 @@ cmake \ "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" \ "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" \ "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" \ + "-DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX" \ "-DSUNSHINE_ASSETS_DIR=$SUNSHINE_ASSETS_DIR" \ "-DSUNSHINE_CONFIG_DIR=$SUNSHINE_CONFIG_DIR" \ "$SUNSHINE_ROOT"