Dockerfile 28 KB

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