Dockerfile 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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 in some paths 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. # NVIDIA driver installer dependencies
  134. kmod \
  135. libc6-dev \
  136. libpci3 \
  137. libelf-dev \
  138. # OpenGL libraries
  139. libxau6 \
  140. libxdmcp6 \
  141. libxcb1 \
  142. libxext6 \
  143. libx11-6 \
  144. libxv1 \
  145. libxtst6 \
  146. libdrm2 \
  147. libegl1 \
  148. libgl1 \
  149. libopengl0 \
  150. libgles1 \
  151. libgles2 \
  152. libglvnd0 \
  153. libglx0 \
  154. libglu1 \
  155. libsm6 \
  156. # NGINX web server
  157. nginx \
  158. apache2-utils && \
  159. # Sanitize NGINX path
  160. sed -i -e 's/\/var\/log\/nginx\/access\.log/\/dev\/stdout/g' -e 's/\/var\/log\/nginx\/error\.log/\/dev\/stderr/g' -e 's/\/run\/nginx\.pid/\/tmp\/nginx\.pid/g' /etc/nginx/nginx.conf && \
  161. echo "error_log /dev/stderr;" >> /etc/nginx/nginx.conf && \
  162. # PipeWire and WirePlumber
  163. 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 && \
  164. 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" && \
  165. 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" && \
  166. apt-get update && apt-get install --no-install-recommends -y \
  167. pipewire \
  168. pipewire-alsa \
  169. pipewire-audio-client-libraries \
  170. pipewire-jack \
  171. pipewire-locales \
  172. pipewire-v4l2 \
  173. pipewire-libcamera \
  174. gstreamer1.0-pipewire \
  175. libpipewire-0.3-modules \
  176. libpipewire-module-x11-bell \
  177. libspa-0.2-jack \
  178. libspa-0.2-modules \
  179. wireplumber \
  180. wireplumber-locales \
  181. gir1.2-wp-0.4 && \
  182. # Packages only meant for x86_64
  183. if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  184. dpkg --add-architecture i386 && apt-get update && apt-get install --no-install-recommends -y \
  185. intel-gpu-tools \
  186. nvtop \
  187. va-driver-all \
  188. i965-va-driver-shaders \
  189. intel-media-va-driver-non-free \
  190. va-driver-all:i386 \
  191. i965-va-driver-shaders:i386 \
  192. intel-media-va-driver-non-free:i386 \
  193. libva2:i386 \
  194. vdpau-driver-all:i386 \
  195. mesa-vulkan-drivers:i386 \
  196. libvulkan-dev:i386 \
  197. libc6:i386 \
  198. libxau6:i386 \
  199. libxdmcp6:i386 \
  200. libxcb1:i386 \
  201. libxext6:i386 \
  202. libx11-6:i386 \
  203. libxv1:i386 \
  204. libxtst6:i386 \
  205. libdrm2:i386 \
  206. libegl1:i386 \
  207. libgl1:i386 \
  208. libopengl0:i386 \
  209. libgles1:i386 \
  210. libgles2:i386 \
  211. libglvnd0:i386 \
  212. libglx0:i386 \
  213. libglu1:i386 \
  214. libsm6:i386; fi && \
  215. # Install nvidia-vaapi-driver, requires the kernel parameter `nvidia_drm.modeset=1` set to run correctly
  216. if [ "$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')" \> "20.04" ]; then \
  217. apt-get update && apt-get install --no-install-recommends -y \
  218. meson \
  219. gstreamer1.0-plugins-bad \
  220. libffmpeg-nvenc-dev \
  221. libva-dev \
  222. libegl-dev \
  223. libgstreamer-plugins-bad1.0-dev && \
  224. NVIDIA_VAAPI_DRIVER_VERSION="$(curl -fsSL "https://api.github.com/repos/elFarto/nvidia-vaapi-driver/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  225. 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/*; fi && \
  226. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  227. echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
  228. echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
  229. # Configure OpenCL manually
  230. mkdir -pm755 /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
  231. # Configure Vulkan manually
  232. VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \
  233. mkdir -pm755 /etc/vulkan/icd.d/ && echo "{\n\
  234. \"file_format_version\" : \"1.0.0\",\n\
  235. \"ICD\": {\n\
  236. \"library_path\": \"libGLX_nvidia.so.0\",\n\
  237. \"api_version\" : \"${VULKAN_API_VERSION}\"\n\
  238. }\n\
  239. }" > /etc/vulkan/icd.d/nvidia_icd.json && \
  240. # Configure EGL manually
  241. mkdir -pm755 /usr/share/glvnd/egl_vendor.d/ && echo "{\n\
  242. \"file_format_version\" : \"1.0.0\",\n\
  243. \"ICD\": {\n\
  244. \"library_path\": \"libEGL_nvidia.so.0\"\n\
  245. }\n\
  246. }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
  247. # Expose NVIDIA libraries and paths
  248. ENV PATH="/usr/local/nvidia/bin${PATH:+:${PATH}}"
  249. ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/nvidia/lib:/usr/local/nvidia/lib64"
  250. # Make all NVIDIA GPUs visible by default
  251. ENV NVIDIA_VISIBLE_DEVICES=all
  252. # All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work
  253. ENV NVIDIA_DRIVER_CAPABILITIES=all
  254. # Disable VSYNC for NVIDIA GPUs
  255. ENV __GL_SYNC_TO_VBLANK=0
  256. # Set default DISPLAY environment
  257. ENV DISPLAY=":0"
  258. # Anything above this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  259. # Default environment variables (password is "mypasswd")
  260. ENV DISPLAY_SIZEW=1920
  261. ENV DISPLAY_SIZEH=1080
  262. ENV DISPLAY_REFRESH=60
  263. ENV DISPLAY_DPI=96
  264. ENV DISPLAY_CDEPTH=24
  265. ENV VIDEO_PORT=DFP
  266. ENV KASMVNC_ENABLE=false
  267. ENV SELKIES_ENCODER=nvh264enc
  268. ENV SELKIES_ENABLE_RESIZE=false
  269. ENV SELKIES_ENABLE_BASIC_AUTH=true
  270. # Install Xorg
  271. RUN apt-get update && apt-get install --no-install-recommends -y \
  272. xorg \
  273. xterm && \
  274. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  275. # Anything below this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  276. # Install KDE and other GUI packages
  277. ENV DESKTOP_SESSION=plasma
  278. ENV XDG_SESSION_DESKTOP=KDE
  279. ENV XDG_CURRENT_DESKTOP=KDE
  280. ENV XDG_SESSION_TYPE=x11
  281. ENV XDG_SESSION_ID="${DISPLAY#*:}"
  282. ENV KDE_FULL_SESSION=true
  283. ENV KDE_APPLICATIONS_AS_SCOPE=1
  284. ENV KWIN_COMPOSE=N
  285. ENV KWIN_X11_NO_SYNC_TO_VBLANK=1
  286. # Use sudoedit to change protected files instead of using sudo on kate
  287. ENV SUDO_EDITOR=kate
  288. # Set input to fcitx
  289. ENV GTK_IM_MODULE=fcitx
  290. ENV QT_IM_MODULE=fcitx
  291. ENV XIM=fcitx
  292. ENV XMODIFIERS="@im=fcitx"
  293. # Enable AppImage execution in containers
  294. ENV APPIMAGE_EXTRACT_AND_RUN=1
  295. RUN mkdir -pm755 /etc/apt/preferences.d && echo "Package: firefox*\n\
  296. Pin: version 1:1snap*\n\
  297. Pin-Priority: -1" > /etc/apt/preferences.d/firefox-nosnap && \
  298. 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 && \
  299. 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" && \
  300. apt-get update && apt-get install --no-install-recommends -y \
  301. kde-plasma-desktop \
  302. adwaita-icon-theme-full \
  303. appmenu-gtk3-module \
  304. ark \
  305. aspell \
  306. aspell-en \
  307. breeze \
  308. breeze-cursor-theme \
  309. breeze-gtk-theme \
  310. breeze-icon-theme \
  311. dbus-x11 \
  312. debconf-kde-helper \
  313. desktop-file-utils \
  314. dolphin \
  315. dolphin-plugins \
  316. enchant-2 \
  317. fcitx \
  318. fcitx-frontend-gtk2 \
  319. fcitx-frontend-gtk3 \
  320. fcitx-frontend-qt5 \
  321. fcitx-module-dbus \
  322. fcitx-module-kimpanel \
  323. fcitx-module-lua \
  324. fcitx-module-x11 \
  325. fcitx-tools \
  326. fcitx-hangul \
  327. fcitx-libpinyin \
  328. fcitx-m17n \
  329. fcitx-mozc \
  330. fcitx-sayura \
  331. fcitx-unikey \
  332. filelight \
  333. frameworkintegration \
  334. gwenview \
  335. haveged \
  336. hunspell \
  337. im-config \
  338. kate \
  339. kcalc \
  340. kcharselect \
  341. kdeadmin \
  342. kde-config-fcitx \
  343. kde-config-gtk-style \
  344. kde-config-gtk-style-preview \
  345. kdeconnect \
  346. kdegraphics-thumbnailers \
  347. kde-spectacle \
  348. kdf \
  349. kdialog \
  350. kget \
  351. kimageformat-plugins \
  352. kinfocenter \
  353. kio \
  354. kio-extras \
  355. kmag \
  356. kmenuedit \
  357. kmix \
  358. kmousetool \
  359. kmouth \
  360. ksshaskpass \
  361. ktimer \
  362. kwayland-integration \
  363. kwin-addons \
  364. kwin-x11 \
  365. libdbusmenu-glib4 \
  366. libdbusmenu-gtk3-4 \
  367. libgail-common \
  368. libgdk-pixbuf2.0-bin \
  369. libgtk2.0-bin \
  370. libgtk-3-bin \
  371. libkf5baloowidgets-bin \
  372. libkf5dbusaddons-bin \
  373. libkf5iconthemes-bin \
  374. libkf5kdelibs4support5-bin \
  375. libkf5khtml-bin \
  376. libkf5parts-plugins \
  377. libqt5multimedia5-plugins \
  378. librsvg2-common \
  379. media-player-info \
  380. okular \
  381. okular-extra-backends \
  382. partitionmanager \
  383. plasma-browser-integration \
  384. plasma-calendar-addons \
  385. plasma-dataengines-addons \
  386. plasma-discover \
  387. plasma-integration \
  388. plasma-runners-addons \
  389. plasma-widgets-addons \
  390. policykit-desktop-privileges \
  391. polkit-kde-agent-1 \
  392. print-manager \
  393. qapt-deb-installer \
  394. qml-module-org-kde-runnermodel \
  395. qml-module-org-kde-qqc2desktopstyle \
  396. qml-module-qtgraphicaleffects \
  397. qml-module-qtquick-xmllistmodel \
  398. qt5-gtk-platformtheme \
  399. qt5-image-formats-plugins \
  400. qt5-style-plugins \
  401. qtspeech5-flite-plugin \
  402. qtvirtualkeyboard-plugin \
  403. software-properties-qt \
  404. sonnet-plugins \
  405. sweeper \
  406. systemsettings \
  407. ubuntu-drivers-common \
  408. vlc \
  409. vlc-l10n \
  410. vlc-plugin-access-extra \
  411. vlc-plugin-notify \
  412. vlc-plugin-samba \
  413. vlc-plugin-skins2 \
  414. vlc-plugin-video-splitter \
  415. vlc-plugin-visualization \
  416. xdg-desktop-portal-kde \
  417. xdg-user-dirs \
  418. firefox \
  419. transmission-qt && \
  420. apt-get install --install-recommends -y \
  421. libreoffice \
  422. libreoffice-kf5 \
  423. libreoffice-plasma \
  424. libreoffice-style-breeze && \
  425. # Install Google Chrome for supported architectures
  426. 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 --in-process-gpu/' /usr/share/applications/google-chrome.desktop; fi && \
  427. # Ensure Firefox as the default web browser
  428. update-alternatives --set x-www-browser /usr/bin/firefox && \
  429. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  430. # Fix KDE startup permissions issues in containers
  431. 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/') && \
  432. cp -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit /tmp/ && \
  433. rm -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  434. cp -f /tmp/start_kdeinit /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  435. rm -f /tmp/start_kdeinit && \
  436. # KDE disable screen lock, double-click to open instead of single-click
  437. echo "[Daemon]\n\
  438. Autolock=false\n\
  439. LockOnResume=false" > /etc/xdg/kscreenlockerrc && \
  440. echo "[KDE]\n\
  441. SingleClick=false\n\
  442. \n\
  443. [KDE Action Restrictions]\n\
  444. action/lock_screen=false\n\
  445. logout=false\n\
  446. \n\
  447. [General]\n\
  448. BrowserApplication=firefox.desktop" > /etc/xdg/kdeglobals
  449. # Wine, Winetricks, and launchers, this process must be consistent with https://wiki.winehq.org/Ubuntu
  450. ARG WINE_BRANCH=staging
  451. RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  452. mkdir -pm755 /etc/apt/keyrings && curl -fsSL -o /etc/apt/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  453. 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" && \
  454. apt-get update && apt-get install --install-recommends -y \
  455. winehq-${WINE_BRANCH} && \
  456. apt-get install --no-install-recommends -y \
  457. q4wine \
  458. playonlinux && \
  459. LUTRIS_VERSION="$(curl -fsSL "https://api.github.com/repos/lutris/lutris/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  460. 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 && \
  461. HEROIC_VERSION="$(curl -fsSL "https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  462. 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 && \
  463. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  464. curl -o /usr/bin/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  465. chmod 755 /usr/bin/winetricks && \
  466. curl -o /usr/share/bash-completion/completions/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"; fi
  467. # Install latest Selkies-GStreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application, should be consistent with Selkies-GStreamer documentation
  468. ARG PIP_BREAK_SYSTEM_PACKAGES=1
  469. RUN apt-get update && apt-get install --no-install-recommends -y \
  470. # GStreamer dependencies
  471. python3-pip \
  472. python3-dev \
  473. python3-gi \
  474. python3-setuptools \
  475. python3-wheel \
  476. libaa1 \
  477. bzip2 \
  478. libgcrypt20 \
  479. libcairo-gobject2 \
  480. libpangocairo-1.0-0 \
  481. libgdk-pixbuf2.0-0 \
  482. libsoup2.4-1 \
  483. libsoup-gnome2.4-1 \
  484. libgirepository-1.0-1 \
  485. glib-networking \
  486. libglib2.0-0 \
  487. libjson-glib-1.0-0 \
  488. libgudev-1.0-0 \
  489. alsa-utils \
  490. jackd2 \
  491. libjack-jackd2-0 \
  492. libpulse0 \
  493. libogg0 \
  494. libopus0 \
  495. libvorbis-dev \
  496. libjpeg-turbo8 \
  497. libopenjp2-7 \
  498. libvpx-dev \
  499. libwebp-dev \
  500. x264 \
  501. x265 \
  502. libdrm2 \
  503. libegl1 \
  504. libgl1 \
  505. libopengl0 \
  506. libgles1 \
  507. libgles2 \
  508. libglvnd0 \
  509. libglx0 \
  510. wayland-protocols \
  511. libwayland-dev \
  512. libwayland-egl1 \
  513. wmctrl \
  514. xsel \
  515. xdotool \
  516. x11-utils \
  517. x11-xserver-utils \
  518. xserver-xorg-core \
  519. libx11-xcb1 \
  520. libxcb-dri3-0 \
  521. libxkbcommon0 \
  522. libxdamage1 \
  523. libxfixes3 \
  524. libxv1 \
  525. libxtst6 \
  526. libxext6 && \
  527. 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 && \
  528. # Automatically fetch the latest selkies-gstreamer version and install the components
  529. SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  530. 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 - && \
  531. 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" && \
  532. 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 - && \
  533. 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 && \
  534. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  535. # Add configuration for Selkies-GStreamer Joystick interposer
  536. ENV SELKIES_INTERPOSER='/usr/$LIB/selkies_joystick_interposer.so'
  537. ENV LD_PRELOAD="${SELKIES_INTERPOSER}${LD_PRELOAD:+:${LD_PRELOAD}}"
  538. ENV SDL_JOYSTICK_DEVICE=/dev/input/js0
  539. # Install the KasmVNC web interface and RustDesk for fallback
  540. RUN KASMVNC_VERSION="$(curl -fsSL "https://api.github.com/repos/kasmtech/KasmVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  541. # Remove sed from noble to jammy after new release
  542. 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 libdatetime-perl && rm -f kasmvncserver.deb && \
  543. RUSTDESK_VERSION="$(curl -fsSL "https://api.github.com/repos/rustdesk/rustdesk/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  544. 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 && \
  545. YQ_VERSION="$(curl -fsSL "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  546. 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 && \
  547. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  548. ENV PATH="${PATH:+${PATH}:}/usr/lib/rustdesk"
  549. ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/lib/rustdesk/lib"
  550. # 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
  551. # Copy scripts and configurations used to start the container with `--chown=1000:1000`
  552. COPY --chown=1000:1000 entrypoint.sh /etc/entrypoint.sh
  553. RUN chmod 755 /etc/entrypoint.sh
  554. COPY --chown=1000:1000 selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  555. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  556. COPY --chown=1000:1000 kasmvnc-entrypoint.sh /etc/kasmvnc-entrypoint.sh
  557. RUN chmod 755 /etc/kasmvnc-entrypoint.sh
  558. COPY --chown=1000:1000 supervisord.conf /etc/supervisord.conf
  559. RUN chmod 755 /etc/supervisord.conf
  560. # Configure coTURN script
  561. RUN echo "#!/bin/bash\n\
  562. set -e\n\
  563. turnserver \
  564. --verbose \
  565. --listening-ip=\"0.0.0.0\" \
  566. --listening-ip=\"::\" \
  567. --listening-port=\"\${SELKIES_TURN_PORT:-3478}\" \
  568. --realm=\"\${TURN_REALM:-example.com}\" \
  569. --external-ip=\"\${SELKIES_TURN_HOST:-\$(curl -fsSL checkip.amazonaws.com)}\" \
  570. --min-port=\"\${TURN_MIN_PORT:-49152}\" \
  571. --max-port=\"\${TURN_MAX_PORT:-65535}\" \
  572. --channel-lifetime=\"\${TURN_CHANNEL_LIFETIME:--1}\" \
  573. --lt-cred-mech \
  574. --user \"selkies:\${TURN_RANDOM_PASSWORD}\" \
  575. --no-cli \
  576. --cli-password=\"\${TURN_RANDOM_PASSWORD:-\$(tr -dc 'A-Za-z0-9' < /dev/urandom 2>/dev/null | head -c 24)}\" \
  577. --allow-loopback-peers \
  578. \${TURN_EXTRA_ARGS} \$@\
  579. " > /etc/start-turnserver.sh && chmod 755 /etc/start-turnserver.sh
  580. SHELL ["/bin/sh", "-c"]
  581. USER 0
  582. # Enable sudo through sudo-root with uid 0
  583. RUN if [ -d /usr/libexec/sudo ]; then SUDO_LIB="/usr/libexec/sudo"; else SUDO_LIB="/usr/lib/sudo"; fi && \
  584. 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 in some paths relevant to sudo' && \
  585. chmod -f 4755 /usr/bin/sudo-root || echo 'Failed to set chmod with sudo-root'
  586. USER 1000
  587. ENV PIPEWIRE_LATENCY="32/48000"
  588. ENV XDG_RUNTIME_DIR=/tmp/runtime-ubuntu
  589. ENV PIPEWIRE_RUNTIME_DIR="${PIPEWIRE_RUNTIME_DIR:-${XDG_RUNTIME_DIR:-/tmp}}"
  590. ENV PULSE_RUNTIME_PATH="${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}"
  591. ENV PULSE_SERVER="${PULSE_SERVER:-unix:${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}/native}"
  592. USER 1000
  593. ENV SHELL=/bin/bash
  594. ENV USER=ubuntu
  595. WORKDIR /home/ubuntu
  596. EXPOSE 8080
  597. ENTRYPOINT ["/usr/bin/supervisord"]