Dockerfile 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at https://mozilla.org/MPL/2.0/.
  4. # Supported base images: Ubuntu 24.04, 22.04, 20.04
  5. ARG DISTRIB_RELEASE=24.04
  6. FROM ubuntu:${DISTRIB_RELEASE}
  7. ARG DISTRIB_RELEASE
  8. LABEL maintainer="https://github.com/ehfd,https://github.com/danisla"
  9. ARG DEBIAN_FRONTEND=noninteractive
  10. # Configure rootless user environment for constrained conditions without escalated root privileges inside containers
  11. ARG TZ=UTC
  12. ARG PASSWD=mypasswd
  13. RUN apt-get clean && apt-get update && apt-get dist-upgrade -y && apt-get install --no-install-recommends -y \
  14. apt-utils \
  15. dbus-user-session \
  16. fakeroot \
  17. locales \
  18. ssl-cert \
  19. sudo \
  20. udev \
  21. tzdata && \
  22. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  23. locale-gen en_US.UTF-8 && \
  24. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone && \
  25. # Only use sudo-root for root-owned directory (/dev, /proc, /sys) or user/group permission operations, not for apt-get installation or file/directory operations
  26. mv -f /usr/bin/sudo /usr/bin/sudo-root && \
  27. ln -snf /usr/bin/fakeroot /usr/bin/sudo && \
  28. groupadd -g 1000 ubuntu || echo 'Failed to add ubuntu group' && \
  29. useradd -ms /bin/bash ubuntu -u 1000 -g 1000 || echo 'Failed to add ubuntu user' && \
  30. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,games,input,lp,plugdev,render,ssl-cert,sudo,tape,tty,video,voice ubuntu && \
  31. echo "ubuntu ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  32. echo "ubuntu:${PASSWD}" | chpasswd && \
  33. chown -R -f --no-preserve-root ubuntu:ubuntu / || echo 'Failed to set filesystem ownership to ubuntu user'
  34. # Set locales
  35. ENV LANG="en_US.UTF-8"
  36. ENV LANGUAGE="en_US:en"
  37. ENV LC_ALL="en_US.UTF-8"
  38. USER 1000
  39. # Use BUILDAH_FORMAT=docker in buildah
  40. SHELL ["/usr/bin/fakeroot", "--", "/bin/sh", "-c"]
  41. # Install operating system libraries or packages
  42. RUN apt-get update && apt-get install --no-install-recommends -y \
  43. # Operating system packages
  44. software-properties-common \
  45. build-essential \
  46. ca-certificates \
  47. cups-browsed \
  48. cups-bsd \
  49. cups-common \
  50. cups-filters \
  51. printer-driver-cups-pdf \
  52. alsa-base \
  53. alsa-utils \
  54. file \
  55. gnupg \
  56. curl \
  57. wget \
  58. bzip2 \
  59. gzip \
  60. xz-utils \
  61. unar \
  62. rar \
  63. unrar \
  64. zip \
  65. unzip \
  66. zstd \
  67. gcc \
  68. git \
  69. coturn \
  70. jq \
  71. python3 \
  72. python3-cups \
  73. python3-numpy \
  74. nano \
  75. vim \
  76. htop \
  77. fonts-dejavu \
  78. fonts-freefont-ttf \
  79. fonts-hack \
  80. fonts-liberation \
  81. fonts-noto \
  82. fonts-noto-cjk \
  83. fonts-noto-cjk-extra \
  84. fonts-noto-color-emoji \
  85. fonts-noto-extra \
  86. fonts-noto-ui-extra \
  87. fonts-noto-hinted \
  88. fonts-noto-mono \
  89. fonts-noto-unhinted \
  90. fonts-opensymbol \
  91. fonts-symbola \
  92. fonts-ubuntu \
  93. lame \
  94. less \
  95. libavcodec-extra \
  96. libpulse0 \
  97. supervisor \
  98. net-tools \
  99. packagekit-tools \
  100. pkg-config \
  101. mesa-utils \
  102. mesa-va-drivers \
  103. libva2 \
  104. vainfo \
  105. vdpau-driver-all \
  106. libvdpau-va-gl1 \
  107. vdpauinfo \
  108. mesa-vulkan-drivers \
  109. vulkan-tools \
  110. radeontop \
  111. libvulkan-dev \
  112. ocl-icd-libopencl1 \
  113. clinfo \
  114. xkb-data \
  115. xauth \
  116. xbitmaps \
  117. xdg-user-dirs \
  118. xdg-utils \
  119. xfonts-base \
  120. xfonts-scalable \
  121. xinit \
  122. xsettingsd \
  123. libxrandr-dev \
  124. x11-xkb-utils \
  125. x11-xserver-utils \
  126. x11-utils \
  127. x11-apps \
  128. xserver-xorg-input-all \
  129. xserver-xorg-input-wacom \
  130. xserver-xorg-video-all \
  131. xserver-xorg-video-intel \
  132. xserver-xorg-video-qxl \
  133. # OpenGL libraries
  134. libxau6 \
  135. libxdmcp6 \
  136. libxcb1 \
  137. libxext6 \
  138. libx11-6 \
  139. libxv1 \
  140. libxtst6 \
  141. libdrm2 \
  142. libegl1 \
  143. libgl1 \
  144. libopengl0 \
  145. libgles1 \
  146. libgles2 \
  147. libglvnd0 \
  148. libglx0 \
  149. libglu1 \
  150. libsm6 && \
  151. # PipeWire and WirePlumber
  152. mkdir -pm755 /etc/apt/trusted.gpg.d && curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xFC43B7352BCC0EC8AF2EEB8B25088A0359807596" | gpg --dearmor -o /etc/apt/trusted.gpg.d/pipewire-debian-ubuntu-pipewire-upstream.gpg && \
  153. mkdir -pm755 /etc/apt/sources.list.d && echo "deb https://ppa.launchpadcontent.net/pipewire-debian/pipewire-upstream/ubuntu $(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"') main" > "/etc/apt/sources.list.d/pipewire-debian-ubuntu-pipewire-upstream-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').list" && \
  154. mkdir -pm755 /etc/apt/sources.list.d && echo "deb https://ppa.launchpadcontent.net/pipewire-debian/wireplumber-upstream/ubuntu $(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"') main" > "/etc/apt/sources.list.d/pipewire-debian-ubuntu-wireplumber-upstream-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').list" && \
  155. apt-get update && apt-get install --no-install-recommends -y \
  156. pipewire \
  157. pipewire-alsa \
  158. pipewire-audio-client-libraries \
  159. pipewire-jack \
  160. pipewire-locales \
  161. pipewire-v4l2 \
  162. pipewire-libcamera \
  163. gstreamer1.0-pipewire \
  164. libpipewire-0.3-modules \
  165. libpipewire-module-x11-bell \
  166. libspa-0.2-jack \
  167. libspa-0.2-modules \
  168. wireplumber \
  169. wireplumber-locales \
  170. gir1.2-wp-0.4 && \
  171. # Packages only meant for x86_64
  172. if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  173. dpkg --add-architecture i386 && apt-get update && apt-get install --no-install-recommends -y \
  174. intel-gpu-tools \
  175. nvtop \
  176. va-driver-all \
  177. i965-va-driver-shaders \
  178. intel-media-va-driver-non-free \
  179. va-driver-all:i386 \
  180. i965-va-driver-shaders:i386 \
  181. intel-media-va-driver-non-free:i386 \
  182. libva2:i386 \
  183. vdpau-driver-all:i386 \
  184. mesa-vulkan-drivers:i386 \
  185. libvulkan-dev:i386 \
  186. libxau6:i386 \
  187. libxdmcp6:i386 \
  188. libxcb1:i386 \
  189. libxext6:i386 \
  190. libx11-6:i386 \
  191. libxv1:i386 \
  192. libxtst6:i386 \
  193. libdrm2:i386 \
  194. libegl1:i386 \
  195. libgl1:i386 \
  196. libopengl0:i386 \
  197. libgles1:i386 \
  198. libgles2:i386 \
  199. libglvnd0:i386 \
  200. libglx0:i386 \
  201. libglu1:i386 \
  202. libsm6:i386; fi && \
  203. # Install nvidia-vaapi-driver
  204. apt-get update && apt-get install --no-install-recommends -y \
  205. meson \
  206. gstreamer1.0-plugins-bad \
  207. libffmpeg-nvenc-dev \
  208. libva-dev \
  209. libegl-dev \
  210. libgstreamer-plugins-bad1.0-dev && \
  211. NVIDIA_VAAPI_DRIVER_VERSION="$(curl -fsSL "https://api.github.com/elFarto/nvidia-vaapi-driver/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  212. cd /tmp && curl -fsSL "https://github.com/elFarto/nvidia-vaapi-driver/archive/v${NVIDIA_VAAPI_DRIVER_VERSION}.tar.gz" | tar -xzf - && mv -f nvidia-vaapi-driver* nvidia-vaapi-driver && cd nvidia-vaapi-driver && meson setup build && meson install -C build && rm -rf /tmp/* && \
  213. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  214. echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
  215. echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
  216. # Configure OpenCL manually
  217. mkdir -pm755 /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
  218. # Configure Vulkan manually
  219. VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \
  220. mkdir -pm755 /etc/vulkan/icd.d/ && echo "{\n\
  221. \"file_format_version\" : \"1.0.0\",\n\
  222. \"ICD\": {\n\
  223. \"library_path\": \"libGLX_nvidia.so.0\",\n\
  224. \"api_version\" : \"${VULKAN_API_VERSION}\"\n\
  225. }\n\
  226. }" > /etc/vulkan/icd.d/nvidia_icd.json && \
  227. # Configure EGL manually
  228. mkdir -pm755 /usr/share/glvnd/egl_vendor.d/ && echo "{\n\
  229. \"file_format_version\" : \"1.0.0\",\n\
  230. \"ICD\": {\n\
  231. \"library_path\": \"libEGL_nvidia.so.0\"\n\
  232. }\n\
  233. }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
  234. # Expose NVIDIA libraries and paths
  235. ENV PATH="/usr/local/nvidia/bin${PATH:+:${PATH}}"
  236. ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/nvidia/lib:/usr/local/nvidia/lib64"
  237. # Make all NVIDIA GPUs visible by default
  238. ENV NVIDIA_VISIBLE_DEVICES=all
  239. # All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work
  240. ENV NVIDIA_DRIVER_CAPABILITIES=all
  241. # Disable VSYNC for NVIDIA GPUs
  242. ENV __GL_SYNC_TO_VBLANK=0
  243. # Set default DISPLAY environment
  244. ENV DISPLAY=":0"
  245. # Anything above this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  246. # Default environment variables (password is "mypasswd")
  247. ENV DISPLAY_SIZEW=1920
  248. ENV DISPLAY_SIZEH=1080
  249. ENV DISPLAY_REFRESH=60
  250. ENV DISPLAY_DPI=96
  251. ENV DISPLAY_CDEPTH=24
  252. ENV VIDEO_PORT=DFP
  253. ENV KASMVNC_ENABLE=false
  254. ENV SELKIES_ENCODER=nvh264enc
  255. ENV SELKIES_ENABLE_RESIZE=false
  256. ENV SELKIES_ENABLE_BASIC_AUTH=true
  257. # Install Xorg and NVIDIA driver installer dependencies
  258. RUN apt-get update && apt-get install --no-install-recommends -y \
  259. kmod \
  260. libc6-dev \
  261. libpci3 \
  262. libelf-dev \
  263. pkg-config \
  264. xorg && \
  265. if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install --no-install-recommends -y libc6:i386; fi && \
  266. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  267. # Anything below this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  268. # Install KDE and other GUI packages
  269. ENV DESKTOP_SESSION=plasma
  270. ENV XDG_SESSION_DESKTOP=KDE
  271. ENV XDG_CURRENT_DESKTOP=KDE
  272. ENV XDG_SESSION_TYPE=x11
  273. ENV XDG_SESSION_ID="${DISPLAY#*:}"
  274. ENV KDE_FULL_SESSION=true
  275. ENV KDE_APPLICATIONS_AS_SCOPE=1
  276. ENV KWIN_COMPOSE=N
  277. ENV KWIN_X11_NO_SYNC_TO_VBLANK=1
  278. # Use sudoedit to change protected files instead of using sudo on kate
  279. ENV SUDO_EDITOR=kate
  280. # Set input to fcitx
  281. ENV GTK_IM_MODULE=fcitx
  282. ENV QT_IM_MODULE=fcitx
  283. ENV XIM=fcitx
  284. ENV XMODIFIERS="@im=fcitx"
  285. # Enable AppImage execution in containers
  286. ENV APPIMAGE_EXTRACT_AND_RUN=1
  287. RUN mkdir -pm755 /etc/apt/preferences.d && echo "Package: firefox*\n\
  288. Pin: version 1:1snap*\n\
  289. Pin-Priority: -1" > /etc/apt/preferences.d/firefox-nosnap && \
  290. mkdir -pm755 /etc/apt/trusted.gpg.d && curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0AB215679C571D1C8325275B9BDB3D89CE49EC21" | gpg --dearmor -o /etc/apt/trusted.gpg.d/mozillateam-ubuntu-ppa.gpg && \
  291. mkdir -pm755 /etc/apt/sources.list.d && echo "deb https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu $(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"') main" > "/etc/apt/sources.list.d/mozillateam-ubuntu-ppa-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').list" && \
  292. apt-get update && apt-get install --no-install-recommends -y \
  293. kde-plasma-desktop \
  294. adwaita-icon-theme-full \
  295. appmenu-gtk3-module \
  296. ark \
  297. aspell \
  298. aspell-en \
  299. breeze \
  300. breeze-cursor-theme \
  301. breeze-gtk-theme \
  302. breeze-icon-theme \
  303. dbus-x11 \
  304. debconf-kde-helper \
  305. desktop-file-utils \
  306. dolphin \
  307. dolphin-plugins \
  308. enchant-2 \
  309. fcitx \
  310. fcitx-frontend-gtk2 \
  311. fcitx-frontend-gtk3 \
  312. fcitx-frontend-qt5 \
  313. fcitx-module-dbus \
  314. fcitx-module-kimpanel \
  315. fcitx-module-lua \
  316. fcitx-module-x11 \
  317. fcitx-tools \
  318. fcitx-hangul \
  319. fcitx-libpinyin \
  320. fcitx-m17n \
  321. fcitx-mozc \
  322. fcitx-sayura \
  323. fcitx-unikey \
  324. filelight \
  325. frameworkintegration \
  326. gwenview \
  327. haveged \
  328. hunspell \
  329. im-config \
  330. kate \
  331. kcalc \
  332. kcharselect \
  333. kdeadmin \
  334. kde-config-fcitx \
  335. kde-config-gtk-style \
  336. kde-config-gtk-style-preview \
  337. kdeconnect \
  338. kdegraphics-thumbnailers \
  339. kde-spectacle \
  340. kdf \
  341. kdialog \
  342. kget \
  343. kimageformat-plugins \
  344. kinfocenter \
  345. kio \
  346. kio-extras \
  347. kmag \
  348. kmenuedit \
  349. kmix \
  350. kmousetool \
  351. kmouth \
  352. ksshaskpass \
  353. ktimer \
  354. kwayland-integration \
  355. kwin-addons \
  356. kwin-x11 \
  357. libdbusmenu-glib4 \
  358. libdbusmenu-gtk3-4 \
  359. libgail-common \
  360. libgdk-pixbuf2.0-bin \
  361. libgtk2.0-bin \
  362. libgtk-3-bin \
  363. libkf5baloowidgets-bin \
  364. libkf5dbusaddons-bin \
  365. libkf5iconthemes-bin \
  366. libkf5kdelibs4support5-bin \
  367. libkf5khtml-bin \
  368. libkf5parts-plugins \
  369. libqt5multimedia5-plugins \
  370. librsvg2-common \
  371. media-player-info \
  372. okular \
  373. okular-extra-backends \
  374. partitionmanager \
  375. plasma-browser-integration \
  376. plasma-calendar-addons \
  377. plasma-dataengines-addons \
  378. plasma-discover \
  379. plasma-integration \
  380. plasma-runners-addons \
  381. plasma-widgets-addons \
  382. policykit-desktop-privileges \
  383. polkit-kde-agent-1 \
  384. print-manager \
  385. qapt-deb-installer \
  386. qml-module-org-kde-runnermodel \
  387. qml-module-org-kde-qqc2desktopstyle \
  388. qml-module-qtgraphicaleffects \
  389. qml-module-qtquick-xmllistmodel \
  390. qt5-gtk-platformtheme \
  391. qt5-image-formats-plugins \
  392. qt5-style-plugins \
  393. qtspeech5-flite-plugin \
  394. qtvirtualkeyboard-plugin \
  395. software-properties-qt \
  396. sonnet-plugins \
  397. sweeper \
  398. systemsettings \
  399. ubuntu-drivers-common \
  400. vlc \
  401. vlc-l10n \
  402. vlc-plugin-access-extra \
  403. vlc-plugin-notify \
  404. vlc-plugin-samba \
  405. vlc-plugin-skins2 \
  406. vlc-plugin-video-splitter \
  407. vlc-plugin-visualization \
  408. xdg-desktop-portal-kde \
  409. xdg-user-dirs \
  410. firefox \
  411. transmission-qt && \
  412. apt-get install --install-recommends -y \
  413. libreoffice \
  414. libreoffice-kf5 \
  415. libreoffice-plasma \
  416. libreoffice-style-breeze && \
  417. # Install Google Chrome for supported architectures
  418. if [ "$(dpkg --print-architecture)" = "amd64" ]; then cd /tmp && curl -o google-chrome-stable.deb -fsSL "https://dl.google.com/linux/direct/google-chrome-stable_current_$(dpkg --print-architecture).deb" && apt-get update && apt-get install --no-install-recommends -y ./google-chrome-stable.deb && rm -f google-chrome-stable.deb && sed -i '/^Exec=/ s/$/ --password-store=basic/' /usr/share/applications/google-chrome.desktop; fi && \
  419. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  420. # Fix KDE startup permissions issues in containers
  421. MULTI_ARCH=$(dpkg --print-architecture | sed -e 's/arm64/aarch64-linux-gnu/' -e 's/armhf/arm-linux-gnueabihf/' -e 's/riscv64/riscv64-linux-gnu/' -e 's/ppc64el/powerpc64le-linux-gnu/' -e 's/s390x/s390x-linux-gnu/' -e 's/i.*86/i386-linux-gnu/' -e 's/amd64/x86_64-linux-gnu/' -e 's/unknown/x86_64-linux-gnu/') && \
  422. cp -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit /tmp/ && \
  423. rm -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  424. cp -f /tmp/start_kdeinit /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  425. rm -f /tmp/start_kdeinit && \
  426. # KDE disable screen lock, double-click to open instead of single-click
  427. echo "[Daemon]\n\
  428. Autolock=false\n\
  429. LockOnResume=false" > /etc/xdg/kscreenlockerrc && \
  430. echo "[KDE]\n\
  431. SingleClick=false\n\
  432. \n\
  433. [KDE Action Restrictions]\n\
  434. action/lock_screen=false\n\
  435. logout=false" > /etc/xdg/kdeglobals
  436. # Wine, Winetricks, Lutris, and PlayOnLinux, this process must be consistent with https://wiki.winehq.org/Ubuntu
  437. ARG WINE_BRANCH=staging
  438. RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  439. mkdir -pm755 /etc/apt/keyrings && curl -fsSL -o /etc/apt/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  440. curl -fsSL -o "/etc/apt/sources.list.d/winehq-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').sources" "https://dl.winehq.org/wine-builds/ubuntu/dists/$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"')/winehq-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').sources" && \
  441. apt-get update && apt-get install --install-recommends -y \
  442. winehq-${WINE_BRANCH} && \
  443. apt-get install --no-install-recommends -y \
  444. q4wine \
  445. playonlinux && \
  446. LUTRIS_VERSION="$(curl -fsSL "https://api.github.com/repos/lutris/lutris/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  447. curl -o lutris.deb -fsSL "https://github.com/lutris/lutris/releases/download/v${LUTRIS_VERSION}/lutris_${LUTRIS_VERSION}_all.deb" && apt-get install --no-install-recommends -y ./lutris.deb && rm -f lutris.deb && \
  448. HEROIC_VERSION="$(curl -fsSL "https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  449. curl -o heroic_launcher.deb -fsSL "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/v${HEROIC_VERSION}/heroic_${HEROIC_VERSION}_$(dpkg --print-architecture).deb" && apt-get install --no-install-recommends -y ./heroic_launcher.deb && rm -f heroic_launcher.deb && \
  450. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  451. curl -o /usr/bin/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  452. chmod 755 /usr/bin/winetricks && \
  453. curl -o /usr/share/bash-completion/completions/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"; fi
  454. # Install latest Selkies-GStreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application, should be consistent with Selkies-GStreamer documentation
  455. ARG PIP_BREAK_SYSTEM_PACKAGES=1
  456. RUN apt-get update && apt-get install --no-install-recommends -y \
  457. # GStreamer dependencies
  458. python3-pip \
  459. python3-dev \
  460. python3-gi \
  461. python3-setuptools \
  462. python3-wheel \
  463. libaa1 \
  464. bzip2 \
  465. libgcrypt20 \
  466. libcairo-gobject2 \
  467. libpangocairo-1.0-0 \
  468. libgdk-pixbuf2.0-0 \
  469. libsoup2.4-1 \
  470. libsoup-gnome2.4-1 \
  471. libgirepository-1.0-1 \
  472. glib-networking \
  473. libglib2.0-0 \
  474. libjson-glib-1.0-0 \
  475. libgudev-1.0-0 \
  476. alsa-utils \
  477. jackd2 \
  478. libjack-jackd2-0 \
  479. libpulse0 \
  480. libogg0 \
  481. libopus0 \
  482. libvorbis-dev \
  483. libjpeg-turbo8 \
  484. libopenjp2-7 \
  485. libvpx-dev \
  486. libwebp-dev \
  487. x264 \
  488. x265 \
  489. libdrm2 \
  490. libegl1 \
  491. libgl1 \
  492. libopengl0 \
  493. libgles1 \
  494. libgles2 \
  495. libglvnd0 \
  496. libglx0 \
  497. wayland-protocols \
  498. libwayland-dev \
  499. libwayland-egl1 \
  500. wmctrl \
  501. xsel \
  502. xdotool \
  503. x11-utils \
  504. x11-xserver-utils \
  505. xserver-xorg-core \
  506. libx11-xcb1 \
  507. libxcb-dri3-0 \
  508. libxkbcommon0 \
  509. libxdamage1 \
  510. libxfixes3 \
  511. libxv1 \
  512. libxtst6 \
  513. libxext6 && \
  514. if [ "$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')" \> "20.04" ]; then apt-get install --no-install-recommends -y xcvt libopenh264-dev libde265-0 svt-av1 aom-tools; else apt-get install --no-install-recommends -y mesa-utils-extra; fi && \
  515. # Automatically fetch the latest selkies-gstreamer version and install the components
  516. SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  517. cd /opt && curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/gstreamer-selkies_gpl_v${SELKIES_VERSION}_ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')_$(dpkg --print-architecture).tar.gz" | tar -xzf - && \
  518. cd /tmp && curl -O -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && pip3 install --no-cache-dir --force-reinstall "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && rm -f "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && \
  519. cd /opt && curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web_v${SELKIES_VERSION}.tar.gz" | tar -xzf - && \
  520. cd /tmp && curl -o selkies-js-interposer.deb -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-js-interposer_v${SELKIES_VERSION}_ubuntu$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')_$(dpkg --print-architecture).deb" && apt-get update && apt-get install --no-install-recommends -y ./selkies-js-interposer.deb && rm -f selkies-js-interposer.deb && \
  521. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  522. # Add configuration for Selkies-GStreamer Joystick interposer
  523. ENV SELKIES_INTERPOSER='/usr/$LIB/selkies_joystick_interposer.so'
  524. ENV LD_PRELOAD="${SELKIES_INTERPOSER}${LD_PRELOAD:+:${LD_PRELOAD}}"
  525. ENV SDL_JOYSTICK_DEVICE=/dev/input/js0
  526. # Install the KasmVNC web interface and RustDesk for fallback
  527. ARG PIP_BREAK_SYSTEM_PACKAGES=1
  528. RUN YQ_VERSION="$(curl -fsSL "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  529. cd /tmp && curl -o yq -fsSL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_$(dpkg --print-architecture)" && install ./yq /usr/bin/ && rm -f yq && \
  530. KASMVNC_VERSION="$(curl -fsSL "https://api.github.com/repos/kasmtech/KasmVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  531. cd /tmp && curl -o kasmvncserver.deb -fsSL "https://github.com/kasmtech/KasmVNC/releases/download/v${KASMVNC_VERSION}/kasmvncserver_$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"' | sed 's/noble/jammy/')_${KASMVNC_VERSION}_$(dpkg --print-architecture).deb" && apt-get update && apt-get install --no-install-recommends -y ./kasmvncserver.deb && rm -f kasmvncserver.deb && \
  532. RUSTDESK_VERSION="$(curl -fsSL "https://api.github.com/repos/rustdesk/rustdesk/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  533. cd /tmp && curl -o rustdesk.deb -fsSL "https://github.com/rustdesk/rustdesk/releases/download/${RUSTDESK_VERSION}/rustdesk-${RUSTDESK_VERSION}-$(uname -m).deb" && apt-get update && apt-get install --no-install-recommends -y ./rustdesk.deb && rm -f rustdesk.deb && \
  534. pip3 install --no-cache-dir --force-reinstall yq && \
  535. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  536. ENV PATH="${PATH:+${PATH}:}/usr/lib/rustdesk"
  537. # Add custom packages right below this comment, or use FROM in a new container and replace entrypoint.sh or supervisord.conf, and set ENTRYPOINT to /usr/bin/supervisord
  538. # Copy scripts and configurations used to start the container with `--chown=1000:1000`
  539. COPY --chown=1000:1000 entrypoint.sh /etc/entrypoint.sh
  540. RUN chmod 755 /etc/entrypoint.sh
  541. COPY --chown=1000:1000 selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  542. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  543. COPY --chown=1000:1000 supervisord.conf /etc/supervisord.conf
  544. RUN chmod 755 /etc/supervisord.conf
  545. # Configure coTURN script
  546. RUN echo "#!/bin/bash\n\
  547. set -e\n\
  548. turnserver \
  549. --verbose \
  550. --listening-ip=\"0.0.0.0\" \
  551. --listening-ip=\"::\" \
  552. --listening-port=\"\${SELKIES_TURN_PORT:-3478}\" \
  553. --realm=\"\${TURN_REALM:-example.com}\" \
  554. --external-ip=\"\${SELKIES_TURN_HOST:-\$(curl -fsSL checkip.amazonaws.com)}\" \
  555. --min-port=\"\${TURN_MIN_PORT:-49152}\" \
  556. --max-port=\"\${TURN_MAX_PORT:-65535}\" \
  557. --channel-lifetime=\"\${TURN_CHANNEL_LIFETIME:--1}\" \
  558. --lt-cred-mech \
  559. --user \"selkies:\${TURN_RANDOM_PASSWORD}\" \
  560. --no-cli \
  561. --cli-password=\"\${TURN_RANDOM_PASSWORD:-\$(tr -dc 'A-Za-z0-9' < /dev/urandom 2>/dev/null | head -c 24)}\" \
  562. --allow-loopback-peers \
  563. \${TURN_EXTRA_ARGS} \$@\
  564. " > /etc/start-turnserver.sh && chmod 755 /etc/start-turnserver.sh
  565. SHELL ["/bin/sh", "-c"]
  566. USER 0
  567. # Enable sudo through sudo-root with uid 0
  568. RUN if [ -d "/usr/libexec/sudo" ]; then SUDO_LIB="/usr/libexec/sudo"; else SUDO_LIB="/usr/lib/sudo"; fi && \
  569. chown -R -f --no-preserve-root root:root /usr/bin/sudo-root /etc/sudo.conf /etc/sudoers /etc/sudoers.d /etc/sudo_logsrvd.conf "${SUDO_LIB}" || echo 'Failed to provide root permissions to sudo' && \
  570. chmod -f 4755 /usr/bin/sudo-root || echo 'Failed to set chmod to sudo-root'
  571. USER 1000
  572. ENV PIPEWIRE_LATENCY="32/48000"
  573. ENV XDG_RUNTIME_DIR=/tmp/runtime-ubuntu
  574. ENV PIPEWIRE_RUNTIME_DIR="${PIPEWIRE_RUNTIME_DIR:-${XDG_RUNTIME_DIR:-/tmp}}"
  575. ENV PULSE_RUNTIME_PATH="${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}"
  576. ENV PULSE_SERVER="${PULSE_SERVER:-unix:${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}/native}"
  577. USER 1000
  578. ENV SHELL=/bin/bash
  579. ENV USER=ubuntu
  580. WORKDIR /home/ubuntu
  581. EXPOSE 8080
  582. ENTRYPOINT ["/usr/bin/supervisord"]