Dockerfile 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. # syntax=docker/dockerfile:1.7
  2. # =============================================================================
  3. # Versions
  4. # =============================================================================
  5. # Update these values whenever the NVIDIA GPU Operator driver changes.
  6. ARG NVIDIA_DRIVER_BRANCH=580
  7. ARG NVIDIA_DRIVER_VERSION=580.173.02
  8. ARG NVIDIA_DRIVER_PACKAGE_VERSION=580.173.02-1ubuntu1
  9. # Sunshine version currently used by the image.
  10. ARG SUNSHINE_REF=f0ea536
  11. ARG SUNSHINE_VERSION=v2026.914.233613
  12. # IMPORTANT:
  13. # This build-deps release contains FFmpeg 9 with dynamic NVENC API selection.
  14. # It can select SDK 11/12/13 at runtime depending on the installed NVIDIA
  15. # driver, which is required for our 580.x driver.
  16. ARG BUILD_DEPS_VERSION=v2026.910.121303
  17. # =============================================================================
  18. # Build Sunshine
  19. #
  20. # FFmpeg is NOT compiled here.
  21. #
  22. # Sunshine's CMake downloads the prebuilt FFmpeg archive published by the
  23. # selected build-deps release.
  24. # =============================================================================
  25. FROM docker.io/nvidia/cuda:12.9.2-devel-ubuntu24.04 AS sunshine-build
  26. ARG SUNSHINE_REF
  27. ARG SUNSHINE_VERSION
  28. ARG BUILD_DEPS_VERSION
  29. ENV DEBIAN_FRONTEND=noninteractive
  30. RUN apt-get update && \
  31. apt-get install -y --no-install-recommends \
  32. ca-certificates \
  33. git && \
  34. rm -rf /var/lib/apt/lists/*
  35. # =============================================================================
  36. # Sunshine sources
  37. # =============================================================================
  38. RUN git clone \
  39. --filter=blob:none \
  40. https://github.com/LizardByte/Sunshine.git \
  41. /src/sunshine && \
  42. cd /src/sunshine && \
  43. git checkout "${SUNSHINE_REF}" && \
  44. git submodule update --init --recursive --depth 1
  45. # =============================================================================
  46. # Override Sunshine's build-deps revision
  47. #
  48. # f0ea536 normally points to an older build-deps release.
  49. #
  50. # Force v2026.910.121303 so Sunshine's ffmpeg.cmake downloads:
  51. #
  52. # https://github.com/LizardByte/build-deps/releases/download/
  53. # v2026.910.121303/Linux-x86_64-ffmpeg.tar.gz
  54. #
  55. # That FFmpeg build includes dynamic NVENC API selection for SDK 11/12/13.
  56. # =============================================================================
  57. RUN set -eux; \
  58. git -C /src/sunshine/third-party/build-deps fetch \
  59. --depth 1 \
  60. --force \
  61. origin \
  62. "refs/tags/${BUILD_DEPS_VERSION}:refs/tags/${BUILD_DEPS_VERSION}"; \
  63. git -C /src/sunshine/third-party/build-deps checkout \
  64. --detach \
  65. "${BUILD_DEPS_VERSION}"; \
  66. ACTUAL_BUILD_DEPS_VERSION="$( \
  67. git -C /src/sunshine/third-party/build-deps \
  68. describe --tags --exact-match \
  69. )"; \
  70. echo "Selected build-deps: ${ACTUAL_BUILD_DEPS_VERSION}"; \
  71. test "${ACTUAL_BUILD_DEPS_VERSION}" = "${BUILD_DEPS_VERSION}"
  72. # =============================================================================
  73. # Sunshine f0ea536 -> FFmpeg 9 NVENC preset compatibility
  74. #
  75. # f0ea536 still converts:
  76. #
  77. # nvenc_preset=1 -> numeric preset 12
  78. #
  79. # FFmpeg 9 uses a different internal numeric range (P1..P7 = 3..9).
  80. #
  81. # Current Sunshine solves this by passing the symbolic FFmpeg preset ("p1",
  82. # "p2", ... "p7") instead of relying on FFmpeg's numeric enum.
  83. #
  84. # Apply the minimal equivalent backport here.
  85. #
  86. # The grep checks intentionally make the build fail if the source no longer
  87. # matches what we expect.
  88. # =============================================================================
  89. RUN set -eux; \
  90. grep -Fq \
  91. ' int preset;' \
  92. /src/sunshine/src/config.h; \
  93. grep -Fq \
  94. ' video.nv_legacy.preset = video.nv.quality_preset + 11;' \
  95. /src/sunshine/src/config.cpp; \
  96. sed -i \
  97. 's/ int preset;/ std::string preset;/' \
  98. /src/sunshine/src/config.h; \
  99. sed -i \
  100. 's/video\.nv_legacy\.preset = video\.nv\.quality_preset + 11;/video.nv_legacy.preset = std::format("p{}", video.nv.quality_preset);/' \
  101. /src/sunshine/src/config.cpp; \
  102. grep -Fq \
  103. ' std::string preset;' \
  104. /src/sunshine/src/config.h; \
  105. grep -Fq \
  106. ' video.nv_legacy.preset = std::format("p{}", video.nv.quality_preset);' \
  107. /src/sunshine/src/config.cpp; \
  108. ! grep -Fq \
  109. 'video.nv_legacy.preset = video.nv.quality_preset + 11;' \
  110. /src/sunshine/src/config.cpp; \
  111. echo "FFmpeg 9 NVENC preset compatibility patch: OK"
  112. # =============================================================================
  113. # Sunshine build dependencies
  114. #
  115. # The CUDA toolkit already exists in the nvidia/cuda base image.
  116. # --skip-cuda prevents linux_build.sh from downloading/installing another one.
  117. #
  118. # Do NOT disable CUDA during the CMake step below: we still use CUDA/NvFBC.
  119. # =============================================================================
  120. RUN cd /src/sunshine && \
  121. ./scripts/linux_build.sh \
  122. --sudo-off \
  123. --skip-cuda \
  124. --step=deps
  125. # =============================================================================
  126. # Configure Sunshine
  127. #
  128. # During this step Sunshine detects BUILD_DEPS_VERSION and downloads the
  129. # corresponding PREBUILT FFmpeg archive.
  130. # =============================================================================
  131. RUN cd /src/sunshine && \
  132. BRANCH=master \
  133. BUILD_VERSION="${SUNSHINE_VERSION}" \
  134. COMMIT="${SUNSHINE_REF}" \
  135. ./scripts/linux_build.sh \
  136. --sudo-off \
  137. --step=cmake
  138. # =============================================================================
  139. # Fail-fast validation
  140. #
  141. # Before spending time compiling Sunshine, make sure:
  142. #
  143. # 1. CMake really used the requested build-deps tag.
  144. # 2. The prebuilt FFmpeg archive exists.
  145. # 3. libavcodec contains the multi-SDK NVENC implementations introduced by
  146. # the dynamic NVENC API patch.
  147. #
  148. # Presence of 11.0 + 12.0 + 13.0 implementations is what we want for
  149. # compatibility with the NVIDIA 580 driver.
  150. # =============================================================================
  151. RUN set -eux; \
  152. ACTUAL_BUILD_DEPS_VERSION="$( \
  153. git -C /src/sunshine/third-party/build-deps \
  154. describe --tags --exact-match \
  155. )"; \
  156. test "${ACTUAL_BUILD_DEPS_VERSION}" = "${BUILD_DEPS_VERSION}"; \
  157. FFMPEG_LIB="/src/sunshine/build/_deps/ffmpeg/lib/libavcodec.a"; \
  158. test -s "${FFMPEG_LIB}"; \
  159. nm -g --defined-only "${FFMPEG_LIB}" \
  160. | grep -F 'ff_nvenc_encode_init_1100' >/dev/null; \
  161. nm -g --defined-only "${FFMPEG_LIB}" \
  162. | grep -F 'ff_nvenc_encode_init_1200' >/dev/null; \
  163. nm -g --defined-only "${FFMPEG_LIB}" \
  164. | grep -F 'ff_nvenc_encode_init_1300' >/dev/null; \
  165. echo "Prebuilt FFmpeg dynamic NVENC API support: OK"
  166. # =============================================================================
  167. # Build + package Sunshine
  168. # =============================================================================
  169. RUN cd /src/sunshine && \
  170. ./scripts/linux_build.sh \
  171. --sudo-off \
  172. --step=build && \
  173. ./scripts/linux_build.sh \
  174. --sudo-off \
  175. --step=package && \
  176. cp \
  177. /src/sunshine/build/cpack_artifacts/Sunshine.deb \
  178. /sunshine.deb
  179. # =============================================================================
  180. # Main image
  181. # =============================================================================
  182. FROM docker.io/library/ubuntu:24.04
  183. ARG NVIDIA_DRIVER_BRANCH
  184. ARG NVIDIA_DRIVER_VERSION
  185. ARG NVIDIA_DRIVER_PACKAGE_VERSION
  186. ARG USER_NAME=ubuntu
  187. ARG USER_UID=1000
  188. ARG USER_GID=1000
  189. ENV DEBIAN_FRONTEND=noninteractive \
  190. HOME=/home/ubuntu \
  191. USER=ubuntu \
  192. DISPLAY=:20 \
  193. DISPLAY_SIZEW=1920 \
  194. DISPLAY_SIZEH=1080 \
  195. DISPLAY_REFRESH=120 \
  196. DISPLAY_DPI=96 \
  197. DISPLAY_CDEPTH=24 \
  198. VIDEO_PORT=HDMI-0 \
  199. TZ=Europe/Paris \
  200. LANG=fr_FR.UTF-8 \
  201. LANGUAGE=fr_FR:fr \
  202. LC_ALL=fr_FR.UTF-8 \
  203. XDG_RUNTIME_DIR=/tmp/runtime-ubuntu \
  204. PIPEWIRE_RUNTIME_DIR=/tmp/runtime-ubuntu \
  205. PULSE_RUNTIME_PATH=/tmp/runtime-ubuntu/pulse \
  206. PULSE_SERVER=unix:/tmp/runtime-ubuntu/pulse/native \
  207. NVIDIA_VISIBLE_DEVICES=all \
  208. NVIDIA_DRIVER_CAPABILITIES=all \
  209. EXPECTED_NVIDIA_DRIVER_VERSION=${NVIDIA_DRIVER_VERSION} \
  210. NVIDIA_I386_PACKAGE_VERSION=${NVIDIA_DRIVER_PACKAGE_VERSION}
  211. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  212. USER root
  213. # =============================================================================
  214. # Base desktop / gaming environment
  215. # =============================================================================
  216. RUN dpkg --add-architecture i386 \
  217. && apt-get update \
  218. && apt-get install --no-install-recommends -y \
  219. btop \
  220. fonts-noto-cjk \
  221. fonts-ubuntu \
  222. mousepad \
  223. nano \
  224. ristretto \
  225. thunar \
  226. ubuntu-wallpapers \
  227. adwaita-icon-theme \
  228. elementary-xfce-icon-theme \
  229. greybird-gtk-theme \
  230. hicolor-icon-theme \
  231. humanity-icon-theme \
  232. keyboard-configuration \
  233. tango-icon-theme \
  234. xfce4-goodies \
  235. xfce4-notifyd \
  236. xfce4-pulseaudio-plugin \
  237. xfonts-base \
  238. xfonts-scalable \
  239. alsa-utils \
  240. ca-certificates \
  241. curl \
  242. dbus \
  243. dbus-user-session \
  244. dbus-x11 \
  245. file \
  246. fonts-dejavu \
  247. fonts-liberation \
  248. fonts-noto \
  249. fonts-noto-color-emoji \
  250. kmod \
  251. libasound2-plugins \
  252. libcap2-bin \
  253. libegl1 \
  254. libgbm1 \
  255. libgl1 \
  256. libglvnd0 \
  257. libglx0 \
  258. libpciaccess0 \
  259. libpulse0 \
  260. libvulkan1 \
  261. libx11-6 \
  262. libx11-xcb1 \
  263. libxdamage1 \
  264. libxext6 \
  265. libxfixes3 \
  266. libxinerama1 \
  267. libxrandr2 \
  268. libxss1 \
  269. libxtst6 \
  270. locales \
  271. mesa-utils \
  272. pciutils \
  273. pipewire \
  274. pipewire-pulse \
  275. procps \
  276. psmisc \
  277. pulseaudio-utils \
  278. sudo \
  279. supervisor \
  280. tzdata \
  281. udev \
  282. vulkan-tools \
  283. wireplumber \
  284. x11-utils \
  285. x11-xserver-utils \
  286. xauth \
  287. xcvt \
  288. xdg-user-dirs \
  289. xdg-utils \
  290. xfce4 \
  291. xfce4-terminal \
  292. xkb-data \
  293. xserver-xorg-core \
  294. xserver-xorg-input-libinput \
  295. xserver-xorg-legacy \
  296. xz-utils \
  297. neofetch \
  298. wmctrl \
  299. && sed -i \
  300. -e 's/^# *fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' \
  301. -e 's/^# *en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' \
  302. /etc/locale.gen \
  303. && locale-gen \
  304. && apt-get clean \
  305. && rm -rf \
  306. /var/lib/apt/lists/* \
  307. /var/cache/apt/* \
  308. /var/cache/debconf/* \
  309. /tmp/* \
  310. /var/tmp/*
  311. # =============================================================================
  312. # Desktop user
  313. # =============================================================================
  314. RUN set -eux; \
  315. if ! getent group "${USER_GID}" >/dev/null; then \
  316. groupadd --gid "${USER_GID}" "${USER_NAME}"; \
  317. fi; \
  318. if ! id -u "${USER_NAME}" >/dev/null 2>&1; then \
  319. useradd \
  320. --uid "${USER_UID}" \
  321. --gid "${USER_GID}" \
  322. --create-home \
  323. --shell /bin/bash \
  324. "${USER_NAME}"; \
  325. else \
  326. usermod --shell /bin/bash "${USER_NAME}"; \
  327. fi; \
  328. for group in \
  329. audio \
  330. games \
  331. input \
  332. render \
  333. tty \
  334. video; \
  335. do \
  336. getent group "${group}" >/dev/null \
  337. && usermod -aG "${group}" "${USER_NAME}" \
  338. || true; \
  339. done; \
  340. echo "${USER_NAME} ALL=(ALL:ALL) NOPASSWD: ALL" \
  341. > "/etc/sudoers.d/${USER_NAME}"; \
  342. chmod 0440 "/etc/sudoers.d/${USER_NAME}"; \
  343. install \
  344. -d \
  345. -o "${USER_UID}" \
  346. -g "${USER_GID}" \
  347. -m 0700 \
  348. /tmp/runtime-ubuntu; \
  349. install \
  350. -d \
  351. -o "${USER_UID}" \
  352. -g "${USER_GID}" \
  353. /home/${USER_NAME}/.config/sunshine \
  354. /games
  355. # =============================================================================
  356. # NVIDIA repository + nvidia-xconfig
  357. #
  358. # Only the userspace Xorg configuration utility is installed here.
  359. # The kernel driver remains fully managed by the NVIDIA GPU Operator.
  360. # =============================================================================
  361. RUN curl -fsSLO \
  362. https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb \
  363. && dpkg -i cuda-keyring_1.1-1_all.deb \
  364. && rm -f cuda-keyring_1.1-1_all.deb \
  365. && apt-get update \
  366. && apt-get install --no-install-recommends -y \
  367. "nvidia-xconfig=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  368. && nvidia-xconfig --version \
  369. && apt-get clean \
  370. && rm -rf \
  371. /var/lib/apt/lists/* \
  372. /var/cache/apt/*
  373. # =============================================================================
  374. # NVIDIA Xorg driver modules
  375. #
  376. # Extract only the Xorg-side NVIDIA modules matching the host driver.
  377. # Do not install the whole amd64 NVIDIA userspace stack with APT.
  378. # =============================================================================
  379. RUN cd /tmp \
  380. && apt-get update \
  381. && apt-get download \
  382. "xserver-xorg-video-nvidia-${NVIDIA_DRIVER_BRANCH}=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  383. && mkdir -p /tmp/nvidia-xorg \
  384. && dpkg-deb -x \
  385. "xserver-xorg-video-nvidia-${NVIDIA_DRIVER_BRANCH}_${NVIDIA_DRIVER_PACKAGE_VERSION}_amd64.deb" \
  386. /tmp/nvidia-xorg \
  387. && install -D -m 0755 \
  388. /tmp/nvidia-xorg/usr/lib/xorg/modules/drivers/nvidia_drv.so \
  389. /usr/lib/xorg/modules/drivers/nvidia_drv.so \
  390. && cp -a \
  391. /tmp/nvidia-xorg/usr/lib/xorg/modules/extensions/libglxserver_nvidia.so* \
  392. /usr/lib/xorg/modules/extensions/ \
  393. && rm -rf \
  394. /tmp/nvidia-xorg \
  395. /tmp/xserver-xorg-video-nvidia-*.deb \
  396. /var/lib/apt/lists/*
  397. # =============================================================================
  398. # NVIDIA GLVND / Vulkan configuration
  399. #
  400. # Actual 64-bit NVIDIA libraries are injected at runtime by the GPU Operator /
  401. # NVIDIA Container Toolkit.
  402. # =============================================================================
  403. RUN printf '%s\n' \
  404. '/usr/local/nvidia/lib' \
  405. '/usr/local/nvidia/lib64' \
  406. > /etc/ld.so.conf.d/nvidia.conf \
  407. && install -d -m 0755 \
  408. /etc/vulkan/icd.d \
  409. /usr/share/glvnd/egl_vendor.d \
  410. && cat > /etc/vulkan/icd.d/nvidia_icd.json <<'EOF'
  411. {
  412. "file_format_version": "1.0.0",
  413. "ICD": {
  414. "library_path": "libGLX_nvidia.so.0",
  415. "api_version": "1.3.0"
  416. }
  417. }
  418. EOF
  419. RUN cat > /usr/share/glvnd/egl_vendor.d/10_nvidia.json <<'EOF'
  420. {
  421. "file_format_version": "1.0.0",
  422. "ICD": {
  423. "library_path": "libEGL_nvidia.so.0"
  424. }
  425. }
  426. EOF
  427. # =============================================================================
  428. # Sunshine
  429. # =============================================================================
  430. COPY --from=sunshine-build /sunshine.deb /tmp/sunshine.deb
  431. RUN apt-get update \
  432. && apt-get install --no-install-recommends -y \
  433. /tmp/sunshine.deb \
  434. && setcap cap_sys_admin,cap_dac_override,cap_sys_nice=ep \
  435. "$(command -v sunshine)" \
  436. && rm -f /tmp/sunshine.deb \
  437. && apt-get clean \
  438. && rm -rf \
  439. /var/lib/apt/lists/* \
  440. /var/cache/apt/*
  441. # =============================================================================
  442. # Steam + 32-bit Linux gaming runtime
  443. # =============================================================================
  444. RUN dpkg --add-architecture i386 \
  445. && apt-get update \
  446. && apt-get install --no-install-recommends -y \
  447. ca-certificates \
  448. curl \
  449. && curl -fsSL \
  450. https://repo.steampowered.com/steam/archive/stable/steam.gpg \
  451. -o /usr/share/keyrings/steam.gpg \
  452. && printf '%s\n' \
  453. 'deb [arch=amd64,i386 signed-by=/usr/share/keyrings/steam.gpg] https://repo.steampowered.com/steam/ stable steam' \
  454. > /etc/apt/sources.list.d/steam-bootstrap.list \
  455. && apt-get update \
  456. && apt-get install --no-install-recommends -y \
  457. steam-launcher \
  458. steam-libs-amd64 \
  459. steam-libs-i386 \
  460. libegl1:amd64 \
  461. libegl1:i386 \
  462. libgbm1:amd64 \
  463. libgbm1:i386 \
  464. libgl1:amd64 \
  465. libgl1:i386 \
  466. libgl1-mesa-dri:amd64 \
  467. libgl1-mesa-dri:i386 \
  468. libglx-mesa0:amd64 \
  469. libglx-mesa0:i386 \
  470. libvulkan1:amd64 \
  471. libvulkan1:i386 \
  472. xdg-desktop-portal \
  473. xdg-desktop-portal-gtk \
  474. && rm -f /etc/apt/sources.list.d/steam-bootstrap.list \
  475. && apt-get clean \
  476. && rm -rf \
  477. /var/lib/apt/lists/* \
  478. /var/cache/apt/*
  479. # =============================================================================
  480. # Non-snap Firefox
  481. # =============================================================================
  482. RUN install -d -m 0755 /etc/apt/keyrings \
  483. && curl -fsSL \
  484. https://packages.mozilla.org/apt/repo-signing-key.gpg \
  485. -o /etc/apt/keyrings/packages.mozilla.org.asc \
  486. && echo \
  487. "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" \
  488. > /etc/apt/sources.list.d/mozilla.list \
  489. && printf '%s\n' \
  490. 'Package: *' \
  491. 'Pin: origin packages.mozilla.org' \
  492. 'Pin-Priority: 1000' \
  493. > /etc/apt/preferences.d/mozilla \
  494. && apt-get update \
  495. && apt-get install --no-install-recommends -y \
  496. firefox \
  497. firefox-l10n-fr \
  498. && apt-get clean
  499. # =============================================================================
  500. # NVIDIA 32-bit userspace
  501. #
  502. # The GPU Operator currently does not provide the compat32 libraries required
  503. # by 32-bit OpenGL applications and Proton/DXVK.
  504. #
  505. # Install the exact userspace version matching the host driver, then keep a
  506. # protected copy under /opt. The NVIDIA runtime can remove/mask the files in
  507. # /usr/lib/i386-linux-gnu when the pod starts; sunshine-entrypoint.sh restores
  508. # them afterwards.
  509. # =============================================================================
  510. RUN dpkg --add-architecture i386 \
  511. && apt-get update \
  512. && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
  513. "libnvidia-common-${NVIDIA_DRIVER_BRANCH}=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  514. "libnvidia-gpucomp-${NVIDIA_DRIVER_BRANCH}:i386=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  515. "libnvidia-decode-${NVIDIA_DRIVER_BRANCH}:i386=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  516. "libnvidia-compute-${NVIDIA_DRIVER_BRANCH}:i386=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  517. "libnvidia-gl-${NVIDIA_DRIVER_BRANCH}:i386=${NVIDIA_DRIVER_PACKAGE_VERSION}" \
  518. && mkdir -p /opt/nvidia-i386 \
  519. && for file in $( \
  520. dpkg -L \
  521. "libnvidia-gl-${NVIDIA_DRIVER_BRANCH}:i386" \
  522. "libnvidia-compute-${NVIDIA_DRIVER_BRANCH}:i386" \
  523. "libnvidia-decode-${NVIDIA_DRIVER_BRANCH}:i386" \
  524. "libnvidia-gpucomp-${NVIDIA_DRIVER_BRANCH}:i386" \
  525. | grep '^/usr/lib/i386-linux-gnu/' \
  526. | sort -u \
  527. ); do \
  528. if [[ -e "${file}" || -L "${file}" ]]; then \
  529. cp -a --parents "${file}" /opt/nvidia-i386/; \
  530. fi; \
  531. done \
  532. && test -e \
  533. /opt/nvidia-i386/usr/lib/i386-linux-gnu/libGLX_nvidia.so.0 \
  534. && test -e \
  535. "/opt/nvidia-i386/usr/lib/i386-linux-gnu/libnvidia-glcore.so.${NVIDIA_DRIVER_VERSION}" \
  536. && ldconfig \
  537. && apt-get clean \
  538. && rm -rf \
  539. /var/lib/apt/lists/* \
  540. /var/cache/apt/*
  541. # Keep APT package indexes available for Steam's dependency checker.
  542. RUN apt-get update \
  543. && apt-get clean
  544. # =============================================================================
  545. # Runtime scripts
  546. # =============================================================================
  547. COPY desktop-entrypoint.sh /etc/desktop-entrypoint.sh
  548. COPY sunshine-entrypoint.sh /etc/sunshine-entrypoint.sh
  549. COPY supervisord.conf /etc/supervisord.conf
  550. COPY --chmod=0755 scripts/ /usr/local/bin/
  551. RUN sed -i 's/\r$//' \
  552. /etc/desktop-entrypoint.sh \
  553. /etc/sunshine-entrypoint.sh \
  554. /etc/supervisord.conf \
  555. && chmod 0755 \
  556. /etc/desktop-entrypoint.sh \
  557. /etc/sunshine-entrypoint.sh \
  558. && chmod 0644 \
  559. /etc/supervisord.conf
  560. # =============================================================================
  561. # Final filesystem permissions
  562. # =============================================================================
  563. RUN chown -R \
  564. "${USER_UID}:${USER_GID}" \
  565. "/home/${USER_NAME}" \
  566. /tmp/runtime-ubuntu
  567. # =============================================================================
  568. # Sanity checks
  569. # =============================================================================
  570. RUN command -v steam \
  571. && command -v nvidia-xconfig \
  572. && command -v supervisord \
  573. && command -v pipewire \
  574. && command -v wireplumber \
  575. && command -v Xorg \
  576. && command -v xfce4-session \
  577. && test -x /etc/sunshine-entrypoint.sh \
  578. && test -x /etc/desktop-entrypoint.sh
  579. # =============================================================================
  580. # Runtime
  581. # =============================================================================
  582. USER 1000:1000
  583. WORKDIR /home/ubuntu
  584. STOPSIGNAL SIGTERM
  585. ENTRYPOINT ["/etc/sunshine-entrypoint.sh"]