Dockerfile 27 KB

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