Skip to content

Commit 5ae7b27

Browse files
committed
Create almalinux-9.dockerfile
1 parent 2af0ce3 commit 5ae7b27

1 file changed

Lines changed: 187 additions & 0 deletions

File tree

docker/almalinux-9.dockerfile

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# syntax=docker/dockerfile:1.4
2+
# artifacts: true
3+
# platforms: linux/amd64,linux/arm64/v8
4+
# platforms_pr: linux/amd64
5+
# no-cache-filters: sunshine-base,artifacts,sunshine
6+
ARG BASE=almalinux
7+
ARG TAG=9
8+
FROM ${BASE}:${TAG} AS sunshine-base
9+
10+
FROM sunshine-base as sunshine-build
11+
12+
ARG TARGETPLATFORM
13+
RUN echo "target_platform: ${TARGETPLATFORM}"
14+
15+
ARG BRANCH
16+
ARG BUILD_VERSION
17+
ARG COMMIT
18+
# note: BUILD_VERSION may be blank
19+
20+
ENV BRANCH=${BRANCH}
21+
ENV BUILD_VERSION=${BUILD_VERSION}
22+
ENV COMMIT=${COMMIT}
23+
24+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
25+
# install dependencies
26+
# hadolint ignore=DL3041
27+
RUN <<_DEPS
28+
#!/bin/bash
29+
set -e
30+
dnf -y update
31+
dnf -y group install "Development Tools"
32+
dnf -y install \
33+
boost-devel-1.75.0* \
34+
cmake-3.20.* \
35+
doxygen \
36+
gcc-11.3.* \
37+
gcc-c++-11.3.* \
38+
git \
39+
graphviz \
40+
libappindicator-gtk3-devel \
41+
libcap-devel \
42+
libcurl-devel \
43+
libdrm-devel \
44+
libevdev-devel \
45+
libnotify-devel \
46+
libva-devel \
47+
libvdpau-devel \
48+
libX11-devel \
49+
libxcb-devel \
50+
libXcursor-devel \
51+
libXfixes-devel \
52+
libXi-devel \
53+
libXinerama-devel \
54+
libXrandr-devel \
55+
libXtst-devel \
56+
mesa-libGL-devel \
57+
miniupnpc-devel \
58+
nodejs \
59+
numactl-devel \
60+
openssl-devel \
61+
opus-devel \
62+
pulseaudio-libs-devel \
63+
python3.9 \
64+
rpm-build \
65+
wget \
66+
which \
67+
xorg-x11-server-Xvfb
68+
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
69+
dnf -y install intel-mediasdk-devel
70+
fi
71+
dnf clean all
72+
rm -rf /var/cache/yum
73+
_DEPS
74+
75+
## install cuda
76+
WORKDIR /build/cuda
77+
## versions: https://developer.nvidia.com/cuda-toolkit-archive
78+
ENV CUDA_VERSION="12.4.0"
79+
ENV CUDA_BUILD="550.54.14"
80+
## hadolint ignore=SC3010
81+
RUN <<_INSTALL_CUDA
82+
#!/bin/bash
83+
set -e
84+
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
85+
cuda_suffix=""
86+
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
87+
cuda_suffix="_sbsa"
88+
fi
89+
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
90+
echo "cuda url: ${url}"
91+
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
92+
chmod a+x ./cuda.run
93+
./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
94+
rm ./cuda.run
95+
_INSTALL_CUDA
96+
97+
# copy repository
98+
WORKDIR /build/sunshine/
99+
COPY --link .. .
100+
101+
# setup build directory
102+
WORKDIR /build/sunshine/build
103+
104+
# cmake and cpack
105+
RUN <<_MAKE
106+
#!/bin/bash
107+
set -e
108+
cmake \
109+
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
110+
-DBUILD_WERROR=ON \
111+
-DCMAKE_BUILD_TYPE=Release \
112+
-DCMAKE_INSTALL_PREFIX=/usr \
113+
-DSUNSHINE_ASSETS_DIR=share/sunshine \
114+
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
115+
-DSUNSHINE_ENABLE_WAYLAND=ON \
116+
-DSUNSHINE_ENABLE_X11=ON \
117+
-DSUNSHINE_ENABLE_DRM=ON \
118+
-DSUNSHINE_ENABLE_CUDA=ON \
119+
/build/sunshine
120+
make -j "$(nproc)"
121+
cpack -G RPM
122+
_MAKE
123+
124+
# run tests
125+
WORKDIR /build/sunshine/build/tests
126+
# hadolint ignore=SC1091
127+
RUN <<_TEST
128+
#!/bin/bash
129+
set -e
130+
export DISPLAY=:1
131+
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
132+
./test_sunshine --gtest_color=yes
133+
_TEST
134+
135+
FROM scratch AS artifacts
136+
ARG BASE
137+
ARG TAG
138+
ARG TARGETARCH
139+
COPY --link --from=sunshine-build /build/sunshine/build/cpack_artifacts/Sunshine.rpm /sunshine-${BASE}-${TAG}-${TARGETARCH}.rpm
140+
141+
FROM sunshine-base as sunshine
142+
143+
# copy deb from builder
144+
COPY --link --from=artifacts /sunshine*.rpm /sunshine.rpm
145+
146+
# install sunshine
147+
RUN <<_INSTALL_SUNSHINE
148+
#!/bin/bash
149+
set -e
150+
dnf -y update
151+
dnf -y install /sunshine.rpm
152+
dnf clean all
153+
rm -rf /var/cache/yum
154+
_INSTALL_SUNSHINE
155+
156+
# network setup
157+
EXPOSE 47984-47990/tcp
158+
EXPOSE 48010
159+
EXPOSE 47998-48000/udp
160+
161+
# setup user
162+
ARG PGID=1000
163+
ENV PGID=${PGID}
164+
ARG PUID=1000
165+
ENV PUID=${PUID}
166+
ENV TZ="UTC"
167+
ARG UNAME=lizard
168+
ENV UNAME=${UNAME}
169+
170+
ENV HOME=/home/$UNAME
171+
172+
# setup user
173+
RUN <<_SETUP_USER
174+
#!/bin/bash
175+
set -e
176+
groupadd -f -g "${PGID}" "${UNAME}"
177+
useradd -lm -d ${HOME} -s /bin/bash -g "${PGID}" -u "${PUID}" "${UNAME}"
178+
mkdir -p ${HOME}/.config/sunshine
179+
ln -s ${HOME}/.config/sunshine /config
180+
chown -R ${UNAME} ${HOME}
181+
_SETUP_USER
182+
183+
USER ${UNAME}
184+
WORKDIR ${HOME}
185+
186+
# entrypoint
187+
ENTRYPOINT ["/usr/bin/sunshine"]

0 commit comments

Comments
 (0)