Dockerfile 26 KB

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