Dockerfile 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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. # Sanitize NGINX path
  155. 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 && \
  156. echo "error_log /dev/stderr;" >> /etc/nginx/nginx.conf && \
  157. # PipeWire and WirePlumber
  158. 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 && \
  159. 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" && \
  160. 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" && \
  161. apt-get update && apt-get install --no-install-recommends -y \
  162. pipewire \
  163. pipewire-alsa \
  164. pipewire-audio-client-libraries \
  165. pipewire-jack \
  166. pipewire-locales \
  167. pipewire-v4l2 \
  168. pipewire-libcamera \
  169. gstreamer1.0-pipewire \
  170. libpipewire-0.3-modules \
  171. libpipewire-module-x11-bell \
  172. libspa-0.2-jack \
  173. libspa-0.2-modules \
  174. wireplumber \
  175. wireplumber-locales \
  176. gir1.2-wp-0.4 && \
  177. # Packages only meant for x86_64
  178. if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  179. dpkg --add-architecture i386 && apt-get update && apt-get install --no-install-recommends -y \
  180. intel-gpu-tools \
  181. nvtop \
  182. va-driver-all \
  183. i965-va-driver-shaders \
  184. intel-media-va-driver-non-free \
  185. va-driver-all:i386 \
  186. i965-va-driver-shaders:i386 \
  187. intel-media-va-driver-non-free:i386 \
  188. libva2:i386 \
  189. vdpau-driver-all:i386 \
  190. mesa-vulkan-drivers:i386 \
  191. libvulkan-dev:i386 \
  192. libxau6:i386 \
  193. libxdmcp6:i386 \
  194. libxcb1:i386 \
  195. libxext6:i386 \
  196. libx11-6:i386 \
  197. libxv1:i386 \
  198. libxtst6:i386 \
  199. libdrm2:i386 \
  200. libegl1:i386 \
  201. libgl1:i386 \
  202. libopengl0:i386 \
  203. libgles1:i386 \
  204. libgles2:i386 \
  205. libglvnd0:i386 \
  206. libglx0:i386 \
  207. libglu1:i386 \
  208. libsm6:i386; fi && \
  209. # Install nvidia-vaapi-driver, requires the kernel parameter `nvidia_drm.modeset=1` set to run correctly
  210. if [ "$(grep VERSION_ID= /etc/os-release | cut -d= -f2 | tr -d '\"')" \> "20.04" ]; then \
  211. apt-get update && apt-get install --no-install-recommends -y \
  212. meson \
  213. gstreamer1.0-plugins-bad \
  214. libffmpeg-nvenc-dev \
  215. libva-dev \
  216. libegl-dev \
  217. libgstreamer-plugins-bad1.0-dev && \
  218. 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')" && \
  219. 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 && \
  220. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  221. echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
  222. echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
  223. # Configure OpenCL manually
  224. mkdir -pm755 /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
  225. # Configure Vulkan manually
  226. VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \
  227. mkdir -pm755 /etc/vulkan/icd.d/ && echo "{\n\
  228. \"file_format_version\" : \"1.0.0\",\n\
  229. \"ICD\": {\n\
  230. \"library_path\": \"libGLX_nvidia.so.0\",\n\
  231. \"api_version\" : \"${VULKAN_API_VERSION}\"\n\
  232. }\n\
  233. }" > /etc/vulkan/icd.d/nvidia_icd.json && \
  234. # Configure EGL manually
  235. mkdir -pm755 /usr/share/glvnd/egl_vendor.d/ && echo "{\n\
  236. \"file_format_version\" : \"1.0.0\",\n\
  237. \"ICD\": {\n\
  238. \"library_path\": \"libEGL_nvidia.so.0\"\n\
  239. }\n\
  240. }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
  241. # Expose NVIDIA libraries and paths
  242. ENV PATH="/usr/local/nvidia/bin${PATH:+:${PATH}}"
  243. ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/nvidia/lib:/usr/local/nvidia/lib64"
  244. # Make all NVIDIA GPUs visible by default
  245. ENV NVIDIA_VISIBLE_DEVICES=all
  246. # All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work
  247. ENV NVIDIA_DRIVER_CAPABILITIES=all
  248. # Disable VSYNC for NVIDIA GPUs
  249. ENV __GL_SYNC_TO_VBLANK=0
  250. # Set default DISPLAY environment
  251. ENV DISPLAY=":0"
  252. # Anything above this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  253. # Default environment variables (password is "mypasswd")
  254. ENV DISPLAY_SIZEW=1920
  255. ENV DISPLAY_SIZEH=1080
  256. ENV DISPLAY_REFRESH=60
  257. ENV DISPLAY_DPI=96
  258. ENV DISPLAY_CDEPTH=24
  259. ENV VIDEO_PORT=DFP
  260. ENV KASMVNC_VIEWONLY=false
  261. ENV SELKIES_ENCODER=nvh264enc
  262. ENV SELKIES_ENABLE_RESIZE=false
  263. ENV SELKIES_ENABLE_BASIC_AUTH=true
  264. # Install Xorg and NVIDIA driver installer dependencies
  265. RUN apt-get update && apt-get install --no-install-recommends -y \
  266. kmod \
  267. libc6-dev \
  268. libpci3 \
  269. libelf-dev \
  270. pkg-config \
  271. xorg && \
  272. if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install --no-install-recommends -y libc6:i386; fi && \
  273. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  274. # Anything below this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  275. # Install KDE and other GUI packages
  276. ENV DESKTOP_SESSION=plasma
  277. ENV XDG_SESSION_DESKTOP=KDE
  278. ENV XDG_CURRENT_DESKTOP=KDE
  279. ENV XDG_SESSION_TYPE=x11
  280. ENV XDG_SESSION_ID="${DISPLAY#*:}"
  281. ENV KDE_FULL_SESSION=true
  282. ENV KDE_APPLICATIONS_AS_SCOPE=1
  283. ENV KWIN_COMPOSE=N
  284. ENV KWIN_X11_NO_SYNC_TO_VBLANK=1
  285. # Use sudoedit to change protected files instead of using sudo on kate
  286. ENV SUDO_EDITOR=kate
  287. # Set input to fcitx
  288. ENV GTK_IM_MODULE=fcitx
  289. ENV QT_IM_MODULE=fcitx
  290. ENV XIM=fcitx
  291. ENV XMODIFIERS="@im=fcitx"
  292. # Enable AppImage execution in containers
  293. ENV APPIMAGE_EXTRACT_AND_RUN=1
  294. RUN mkdir -pm755 /etc/apt/preferences.d && echo "Package: firefox*\n\
  295. Pin: version 1:1snap*\n\
  296. Pin-Priority: -1" > /etc/apt/preferences.d/firefox-nosnap && \
  297. 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 && \
  298. 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" && \
  299. apt-get update && apt-get install --no-install-recommends -y \
  300. kde-plasma-desktop \
  301. adwaita-icon-theme-full \
  302. appmenu-gtk3-module \
  303. ark \
  304. aspell \
  305. aspell-en \
  306. breeze \
  307. breeze-cursor-theme \
  308. breeze-gtk-theme \
  309. breeze-icon-theme \
  310. dbus-x11 \
  311. debconf-kde-helper \
  312. desktop-file-utils \
  313. dolphin \
  314. dolphin-plugins \
  315. enchant-2 \
  316. fcitx \
  317. fcitx-frontend-gtk2 \
  318. fcitx-frontend-gtk3 \
  319. fcitx-frontend-qt5 \
  320. fcitx-module-dbus \
  321. fcitx-module-kimpanel \
  322. fcitx-module-lua \
  323. fcitx-module-x11 \
  324. fcitx-tools \
  325. fcitx-hangul \
  326. fcitx-libpinyin \
  327. fcitx-m17n \
  328. fcitx-mozc \
  329. fcitx-sayura \
  330. fcitx-unikey \
  331. filelight \
  332. frameworkintegration \
  333. gwenview \
  334. haveged \
  335. hunspell \
  336. im-config \
  337. kate \
  338. kcalc \
  339. kcharselect \
  340. kdeadmin \
  341. kde-config-fcitx \
  342. kde-config-gtk-style \
  343. kde-config-gtk-style-preview \
  344. kdeconnect \
  345. kdegraphics-thumbnailers \
  346. kde-spectacle \
  347. kdf \
  348. kdialog \
  349. kget \
  350. kimageformat-plugins \
  351. kinfocenter \
  352. kio \
  353. kio-extras \
  354. kmag \
  355. kmenuedit \
  356. kmix \
  357. kmousetool \
  358. kmouth \
  359. ksshaskpass \
  360. ktimer \
  361. kwayland-integration \
  362. kwin-addons \
  363. kwin-x11 \
  364. libdbusmenu-glib4 \
  365. libdbusmenu-gtk3-4 \
  366. libgail-common \
  367. libgdk-pixbuf2.0-bin \
  368. libgtk2.0-bin \
  369. libgtk-3-bin \
  370. libkf5baloowidgets-bin \
  371. libkf5dbusaddons-bin \
  372. libkf5iconthemes-bin \
  373. libkf5kdelibs4support5-bin \
  374. libkf5khtml-bin \
  375. libkf5parts-plugins \
  376. libqt5multimedia5-plugins \
  377. librsvg2-common \
  378. media-player-info \
  379. okular \
  380. okular-extra-backends \
  381. partitionmanager \
  382. plasma-browser-integration \
  383. plasma-calendar-addons \
  384. plasma-dataengines-addons \
  385. plasma-discover \
  386. plasma-integration \
  387. plasma-runners-addons \
  388. plasma-widgets-addons \
  389. policykit-desktop-privileges \
  390. polkit-kde-agent-1 \
  391. print-manager \
  392. qapt-deb-installer \
  393. qml-module-org-kde-runnermodel \
  394. qml-module-org-kde-qqc2desktopstyle \
  395. qml-module-qtgraphicaleffects \
  396. qml-module-qtquick-xmllistmodel \
  397. qt5-gtk-platformtheme \
  398. qt5-image-formats-plugins \
  399. qt5-style-plugins \
  400. qtspeech5-flite-plugin \
  401. qtvirtualkeyboard-plugin \
  402. software-properties-qt \
  403. sonnet-plugins \
  404. sweeper \
  405. systemsettings \
  406. ubuntu-drivers-common \
  407. vlc \
  408. vlc-l10n \
  409. vlc-plugin-access-extra \
  410. vlc-plugin-notify \
  411. vlc-plugin-samba \
  412. vlc-plugin-skins2 \
  413. vlc-plugin-video-splitter \
  414. vlc-plugin-visualization \
  415. xdg-desktop-portal-kde \
  416. xdg-user-dirs \
  417. firefox \
  418. transmission-qt && \
  419. apt-get install --install-recommends -y \
  420. libreoffice \
  421. libreoffice-kf5 \
  422. libreoffice-plasma \
  423. libreoffice-style-breeze && \
  424. # Install Google Chrome for supported architectures
  425. 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 && \
  426. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  427. # Fix KDE startup permissions issues in containers
  428. 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/') && \
  429. cp -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit /tmp/ && \
  430. rm -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  431. cp -f /tmp/start_kdeinit /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  432. rm -f /tmp/start_kdeinit && \
  433. # KDE disable screen lock, double-click to open instead of single-click
  434. echo "[Daemon]\n\
  435. Autolock=false\n\
  436. LockOnResume=false" > /etc/xdg/kscreenlockerrc && \
  437. echo "[KDE]\n\
  438. SingleClick=false\n\
  439. \n\
  440. [KDE Action Restrictions]\n\
  441. action/lock_screen=false\n\
  442. logout=false" > /etc/xdg/kdeglobals
  443. # Wine, Winetricks, Lutris, and PlayOnLinux, this process must be consistent with https://wiki.winehq.org/Ubuntu
  444. ARG WINE_BRANCH=staging
  445. RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  446. mkdir -pm755 /etc/apt/keyrings && curl -fsSL -o /etc/apt/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  447. 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" && \
  448. apt-get update && apt-get install --install-recommends -y \
  449. winehq-${WINE_BRANCH} && \
  450. apt-get install --no-install-recommends -y \
  451. q4wine \
  452. playonlinux && \
  453. LUTRIS_VERSION="$(curl -fsSL "https://api.github.com/repos/lutris/lutris/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  454. 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 && \
  455. HEROIC_VERSION="$(curl -fsSL "https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  456. 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 && \
  457. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  458. curl -o /usr/bin/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  459. chmod 755 /usr/bin/winetricks && \
  460. curl -o /usr/share/bash-completion/completions/winetricks -fsSL "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"; fi
  461. # Install latest Selkies-GStreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application, should be consistent with Selkies-GStreamer documentation
  462. ARG PIP_BREAK_SYSTEM_PACKAGES=1
  463. RUN apt-get update && apt-get install --no-install-recommends -y \
  464. # GStreamer dependencies
  465. python3-pip \
  466. python3-dev \
  467. python3-gi \
  468. python3-setuptools \
  469. python3-wheel \
  470. libaa1 \
  471. bzip2 \
  472. libgcrypt20 \
  473. libcairo-gobject2 \
  474. libpangocairo-1.0-0 \
  475. libgdk-pixbuf2.0-0 \
  476. libsoup2.4-1 \
  477. libsoup-gnome2.4-1 \
  478. libgirepository-1.0-1 \
  479. glib-networking \
  480. libglib2.0-0 \
  481. libjson-glib-1.0-0 \
  482. libgudev-1.0-0 \
  483. alsa-utils \
  484. jackd2 \
  485. libjack-jackd2-0 \
  486. libpulse0 \
  487. libogg0 \
  488. libopus0 \
  489. libvorbis-dev \
  490. libjpeg-turbo8 \
  491. libopenjp2-7 \
  492. libvpx-dev \
  493. libwebp-dev \
  494. x264 \
  495. x265 \
  496. libdrm2 \
  497. libegl1 \
  498. libgl1 \
  499. libopengl0 \
  500. libgles1 \
  501. libgles2 \
  502. libglvnd0 \
  503. libglx0 \
  504. wayland-protocols \
  505. libwayland-dev \
  506. libwayland-egl1 \
  507. wmctrl \
  508. xsel \
  509. xdotool \
  510. x11-utils \
  511. x11-xserver-utils \
  512. xserver-xorg-core \
  513. libx11-xcb1 \
  514. libxcb-dri3-0 \
  515. libxkbcommon0 \
  516. libxdamage1 \
  517. libxfixes3 \
  518. libxv1 \
  519. libxtst6 \
  520. libxext6 && \
  521. 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 && \
  522. # Automatically fetch the latest selkies-gstreamer version and install the components
  523. SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  524. 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 - && \
  525. 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" && \
  526. 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 - && \
  527. 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 && \
  528. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  529. # Add configuration for Selkies-GStreamer Joystick interposer
  530. ENV SELKIES_INTERPOSER='/usr/$LIB/selkies_joystick_interposer.so'
  531. ENV LD_PRELOAD="${SELKIES_INTERPOSER}${LD_PRELOAD:+:${LD_PRELOAD}}"
  532. ENV SDL_JOYSTICK_DEVICE=/dev/input/js0
  533. # Install the KasmVNC web interface and RustDesk for fallback
  534. RUN KASMVNC_VERSION="$(curl -fsSL "https://api.github.com/repos/kasmtech/KasmVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  535. # Remove sed from noble to jammy after new release
  536. 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 && \
  537. RUSTDESK_VERSION="$(curl -fsSL "https://api.github.com/repos/rustdesk/rustdesk/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  538. 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 && \
  539. YQ_VERSION="$(curl -fsSL "https://api.github.com/repos/mikefarah/yq/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  540. 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 && \
  541. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  542. ENV PATH="${PATH:+${PATH}:}/usr/lib/rustdesk"
  543. # 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
  544. # Copy scripts and configurations used to start the container with `--chown=1000:1000`
  545. COPY --chown=1000:1000 entrypoint.sh /etc/entrypoint.sh
  546. RUN chmod 755 /etc/entrypoint.sh
  547. COPY --chown=1000:1000 selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  548. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  549. COPY --chown=1000:1000 kasmvnc-entrypoint.sh /etc/kasmvnc-entrypoint.sh
  550. RUN chmod 755 /etc/kasmvnc-entrypoint.sh
  551. COPY --chown=1000:1000 supervisord.conf /etc/supervisord.conf
  552. RUN chmod 755 /etc/supervisord.conf
  553. # Configure coTURN script
  554. RUN echo "#!/bin/bash\n\
  555. set -e\n\
  556. turnserver \
  557. --verbose \
  558. --listening-ip=\"0.0.0.0\" \
  559. --listening-ip=\"::\" \
  560. --listening-port=\"\${SELKIES_TURN_PORT:-3478}\" \
  561. --realm=\"\${TURN_REALM:-example.com}\" \
  562. --external-ip=\"\${SELKIES_TURN_HOST:-\$(curl -fsSL checkip.amazonaws.com)}\" \
  563. --min-port=\"\${TURN_MIN_PORT:-49152}\" \
  564. --max-port=\"\${TURN_MAX_PORT:-65535}\" \
  565. --channel-lifetime=\"\${TURN_CHANNEL_LIFETIME:--1}\" \
  566. --lt-cred-mech \
  567. --user \"selkies:\${TURN_RANDOM_PASSWORD}\" \
  568. --no-cli \
  569. --cli-password=\"\${TURN_RANDOM_PASSWORD:-\$(tr -dc 'A-Za-z0-9' < /dev/urandom 2>/dev/null | head -c 24)}\" \
  570. --allow-loopback-peers \
  571. \${TURN_EXTRA_ARGS} \$@\
  572. " > /etc/start-turnserver.sh && chmod 755 /etc/start-turnserver.sh
  573. SHELL ["/bin/sh", "-c"]
  574. USER 0
  575. # Enable sudo through sudo-root with uid 0
  576. RUN if [ -d /usr/libexec/sudo ]; then SUDO_LIB="/usr/libexec/sudo"; else SUDO_LIB="/usr/lib/sudo"; fi && \
  577. 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' && \
  578. chmod -f 4755 /usr/bin/sudo-root || echo 'Failed to set chmod with sudo-root'
  579. USER 1000
  580. ENV PIPEWIRE_LATENCY="32/48000"
  581. ENV XDG_RUNTIME_DIR=/tmp/runtime-ubuntu
  582. ENV PIPEWIRE_RUNTIME_DIR="${PIPEWIRE_RUNTIME_DIR:-${XDG_RUNTIME_DIR:-/tmp}}"
  583. ENV PULSE_RUNTIME_PATH="${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}"
  584. ENV PULSE_SERVER="${PULSE_SERVER:-unix:${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}/native}"
  585. USER 1000
  586. ENV SHELL=/bin/bash
  587. ENV USER=ubuntu
  588. WORKDIR /home/ubuntu
  589. EXPOSE 8080
  590. ENTRYPOINT ["/usr/bin/supervisord"]