2023-01-22 14:53:42 +00:00
|
|
|
# syntax=docker/dockerfile:1.4
|
2023-01-15 14:31:37 +00:00
|
|
|
# artifacts: true
|
|
|
|
# platforms: linux/amd64,linux/arm64/v8
|
2023-01-22 14:53:42 +00:00
|
|
|
# platforms_pr: linux/amd64
|
2023-02-20 20:03:03 +00:00
|
|
|
# no-cache-filters: sunshine-base,artifacts,sunshine
|
2023-01-15 14:31:37 +00:00
|
|
|
ARG BASE=debian
|
|
|
|
ARG TAG=bullseye
|
|
|
|
FROM ${BASE}:${TAG} AS sunshine-base
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
FROM sunshine-base as sunshine-build
|
|
|
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
|
|
|
|
2023-03-09 23:13:57 +00:00
|
|
|
ARG BRANCH
|
|
|
|
ARG BUILD_VERSION
|
|
|
|
ARG COMMIT
|
|
|
|
# note: BUILD_VERSION may be blank
|
|
|
|
|
|
|
|
ENV BRANCH=${BRANCH}
|
|
|
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
|
|
|
ENV COMMIT=${COMMIT}
|
|
|
|
|
2023-01-15 14:31:37 +00:00
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
# install dependencies
|
|
|
|
RUN <<_DEPS
|
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y --no-install-recommends \
|
2023-05-03 03:04:33 +00:00
|
|
|
build-essential \
|
2023-12-28 00:25:49 +00:00
|
|
|
ca-certificates \
|
2023-05-03 03:04:33 +00:00
|
|
|
cmake=3.18.* \
|
|
|
|
git \
|
|
|
|
libavdevice-dev \
|
2023-09-18 22:14:53 +00:00
|
|
|
libayatana-appindicator3-dev \
|
2023-05-03 03:04:33 +00:00
|
|
|
libboost-filesystem-dev=1.74.* \
|
|
|
|
libboost-locale-dev=1.74.* \
|
|
|
|
libboost-log-dev=1.74.* \
|
|
|
|
libboost-program-options-dev=1.74.* \
|
|
|
|
libcap-dev \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
libdrm-dev \
|
|
|
|
libevdev-dev \
|
2024-01-01 23:48:27 +00:00
|
|
|
libminiupnpc-dev \
|
2023-09-18 22:14:53 +00:00
|
|
|
libnotify-dev \
|
2023-05-03 03:04:33 +00:00
|
|
|
libnuma-dev \
|
|
|
|
libopus-dev \
|
|
|
|
libpulse-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libva-dev \
|
|
|
|
libvdpau-dev \
|
|
|
|
libwayland-dev \
|
|
|
|
libx11-dev \
|
|
|
|
libxcb-shm0-dev \
|
|
|
|
libxcb-xfixes0-dev \
|
|
|
|
libxcb1-dev \
|
|
|
|
libxfixes-dev \
|
|
|
|
libxrandr-dev \
|
|
|
|
libxtst-dev \
|
2024-01-21 21:53:30 +00:00
|
|
|
udev \
|
2023-05-03 03:04:33 +00:00
|
|
|
wget
|
2023-01-15 14:31:37 +00:00
|
|
|
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
|
|
|
apt-get install -y --no-install-recommends \
|
2023-05-03 03:04:33 +00:00
|
|
|
libmfx-dev
|
2023-01-15 14:31:37 +00:00
|
|
|
fi
|
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
_DEPS
|
|
|
|
|
2023-12-28 00:25:49 +00:00
|
|
|
#Install Node
|
|
|
|
# hadolint ignore=SC1091
|
|
|
|
RUN <<_INSTALL_NODE
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
|
|
|
source "$HOME/.nvm/nvm.sh"
|
|
|
|
nvm install 20.9.0
|
|
|
|
nvm use 20.9.0
|
|
|
|
_INSTALL_NODE
|
|
|
|
|
2023-01-15 14:31:37 +00:00
|
|
|
# install cuda
|
|
|
|
WORKDIR /build/cuda
|
|
|
|
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
|
|
|
ENV CUDA_VERSION="11.8.0"
|
|
|
|
ENV CUDA_BUILD="520.61.05"
|
|
|
|
# hadolint ignore=SC3010
|
|
|
|
RUN <<_INSTALL_CUDA
|
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
|
|
|
cuda_suffix=""
|
|
|
|
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
|
|
|
cuda_suffix="_sbsa"
|
|
|
|
fi
|
|
|
|
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
|
|
|
echo "cuda url: ${url}"
|
|
|
|
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
|
|
|
chmod a+x ./cuda.run
|
|
|
|
./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
|
|
|
|
rm ./cuda.run
|
|
|
|
_INSTALL_CUDA
|
|
|
|
|
|
|
|
# copy repository
|
|
|
|
WORKDIR /build/sunshine/
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link .. .
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
# setup build directory
|
|
|
|
WORKDIR /build/sunshine/build
|
|
|
|
|
|
|
|
# cmake and cpack
|
2023-12-28 00:25:49 +00:00
|
|
|
# hadolint ignore=SC1091
|
2023-01-15 14:31:37 +00:00
|
|
|
RUN <<_MAKE
|
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2023-12-28 00:25:49 +00:00
|
|
|
#Set Node version
|
|
|
|
source "$HOME/.nvm/nvm.sh"
|
|
|
|
nvm use 20.9.0
|
2023-01-15 14:31:37 +00:00
|
|
|
cmake \
|
2024-02-25 03:34:53 +00:00
|
|
|
-DBUILD_WERROR=ON \
|
2023-01-15 14:31:37 +00:00
|
|
|
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DSUNSHINE_ASSETS_DIR=share/sunshine \
|
|
|
|
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
|
|
|
|
-DSUNSHINE_ENABLE_WAYLAND=ON \
|
|
|
|
-DSUNSHINE_ENABLE_X11=ON \
|
|
|
|
-DSUNSHINE_ENABLE_DRM=ON \
|
|
|
|
-DSUNSHINE_ENABLE_CUDA=ON \
|
|
|
|
/build/sunshine
|
|
|
|
make -j "$(nproc)"
|
|
|
|
cpack -G DEB
|
|
|
|
_MAKE
|
|
|
|
|
|
|
|
FROM scratch AS artifacts
|
|
|
|
ARG BASE
|
|
|
|
ARG TAG
|
|
|
|
ARG TARGETARCH
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.deb /sunshine-${BASE}-${TAG}-${TARGETARCH}.deb
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
FROM sunshine-base as sunshine
|
|
|
|
|
|
|
|
# copy deb from builder
|
2023-02-20 20:03:03 +00:00
|
|
|
COPY --link --from=artifacts /sunshine*.deb /sunshine.deb
|
2023-01-15 14:31:37 +00:00
|
|
|
|
|
|
|
# install sunshine
|
|
|
|
RUN <<_INSTALL_SUNSHINE
|
|
|
|
#!/bin/bash
|
2023-02-13 20:27:51 +00:00
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y --no-install-recommends /sunshine.deb
|
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
_INSTALL_SUNSHINE
|
|
|
|
|
|
|
|
# network setup
|
|
|
|
EXPOSE 47984-47990/tcp
|
|
|
|
EXPOSE 48010
|
|
|
|
EXPOSE 47998-48000/udp
|
|
|
|
|
|
|
|
# setup user
|
|
|
|
ARG PGID=1000
|
|
|
|
ENV PGID=${PGID}
|
|
|
|
ARG PUID=1000
|
|
|
|
ENV PUID=${PUID}
|
|
|
|
ENV TZ="UTC"
|
|
|
|
ARG UNAME=lizard
|
|
|
|
ENV UNAME=${UNAME}
|
|
|
|
|
|
|
|
ENV HOME=/home/$UNAME
|
|
|
|
|
|
|
|
# setup user
|
|
|
|
RUN <<_SETUP_USER
|
2023-02-13 20:27:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2023-01-15 14:31:37 +00:00
|
|
|
groupadd -f -g "${PGID}" "${UNAME}"
|
2023-04-07 22:14:50 +00:00
|
|
|
useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}"
|
2023-01-15 14:31:37 +00:00
|
|
|
mkdir -p ${HOME}/.config/sunshine
|
|
|
|
ln -s ${HOME}/.config/sunshine /config
|
|
|
|
chown -R ${UNAME} ${HOME}
|
|
|
|
_SETUP_USER
|
|
|
|
|
|
|
|
USER ${UNAME}
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
# entrypoint
|
|
|
|
ENTRYPOINT ["/usr/bin/sunshine"]
|