Dockerfile 28 KB

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