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