Dockerfile 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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. fuse \
  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 --no-preserve-root ubuntu:ubuntu / || echo 'Failed to set filesystem ownership 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. coturn \
  71. jq \
  72. python3 \
  73. python3-cups \
  74. python3-numpy \
  75. nano \
  76. vim \
  77. htop \
  78. fonts-dejavu \
  79. fonts-freefont-ttf \
  80. fonts-hack \
  81. fonts-liberation \
  82. fonts-noto \
  83. fonts-noto-cjk \
  84. fonts-noto-cjk-extra \
  85. fonts-noto-color-emoji \
  86. fonts-noto-extra \
  87. fonts-noto-ui-extra \
  88. fonts-noto-hinted \
  89. fonts-noto-mono \
  90. fonts-noto-unhinted \
  91. fonts-opensymbol \
  92. fonts-symbola \
  93. fonts-ubuntu \
  94. lame \
  95. less \
  96. libavcodec-extra \
  97. libpulse0 \
  98. supervisor \
  99. net-tools \
  100. packagekit-tools \
  101. pkg-config \
  102. mesa-utils \
  103. mesa-va-drivers \
  104. libva2 \
  105. vainfo \
  106. vdpau-driver-all \
  107. libvdpau-va-gl1 \
  108. vdpauinfo \
  109. mesa-vulkan-drivers \
  110. vulkan-tools \
  111. radeontop \
  112. libvulkan-dev \
  113. ocl-icd-libopencl1 \
  114. clinfo \
  115. dbus-x11 \
  116. libdbus-c++-1-0v5 \
  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. # OpenGL libraries
  137. libxau6 \
  138. libxdmcp6 \
  139. libxcb1 \
  140. libxext6 \
  141. libx11-6 \
  142. libxv1 \
  143. libxtst6 \
  144. libdrm2 \
  145. libegl1 \
  146. libgl1 \
  147. libopengl0 \
  148. libgles1 \
  149. libgles2 \
  150. libglvnd0 \
  151. libglx0 \
  152. libglu1 \
  153. libsm6 && \
  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. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  207. echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
  208. echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
  209. # Configure OpenCL manually
  210. mkdir -pm755 /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd && \
  211. # Configure Vulkan manually
  212. VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \
  213. mkdir -pm755 /etc/vulkan/icd.d/ && echo "{\n\
  214. \"file_format_version\" : \"1.0.0\",\n\
  215. \"ICD\": {\n\
  216. \"library_path\": \"libGLX_nvidia.so.0\",\n\
  217. \"api_version\" : \"${VULKAN_API_VERSION}\"\n\
  218. }\n\
  219. }" > /etc/vulkan/icd.d/nvidia_icd.json && \
  220. # Configure EGL manually
  221. mkdir -pm755 /usr/share/glvnd/egl_vendor.d/ && echo "{\n\
  222. \"file_format_version\" : \"1.0.0\",\n\
  223. \"ICD\": {\n\
  224. \"library_path\": \"libEGL_nvidia.so.0\"\n\
  225. }\n\
  226. }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
  227. # Expose NVIDIA libraries and paths
  228. ENV PATH="/usr/local/nvidia/bin${PATH:+:${PATH}}"
  229. ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/nvidia/lib:/usr/local/nvidia/lib64"
  230. # Make all NVIDIA GPUs visible by default
  231. ENV NVIDIA_VISIBLE_DEVICES=all
  232. # All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work
  233. ENV NVIDIA_DRIVER_CAPABILITIES=all
  234. # Disable VSYNC for NVIDIA GPUs
  235. ENV __GL_SYNC_TO_VBLANK=0
  236. # Set default DISPLAY environment
  237. ENV DISPLAY=":0"
  238. # Anything above this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  239. # Default environment variables (password is "mypasswd")
  240. ENV DESKTOP_SIZEW=1920
  241. ENV DESKTOP_SIZEH=1080
  242. ENV DESKTOP_REFRESH=60
  243. ENV DESKTOP_DPI=96
  244. ENV DESKTOP_CDEPTH=24
  245. ENV VIDEO_PORT=DFP
  246. ENV NOVNC_ENABLE=false
  247. ENV SELKIES_ENCODER=nvh264enc
  248. ENV SELKIES_ENABLE_RESIZE=false
  249. ENV SELKIES_ENABLE_BASIC_AUTH=true
  250. # Set versions for components that should be manually checked before upgrading, other component versions are automatically determined by fetching the version online
  251. ARG NOVNC_VERSION=1.5.0
  252. # Install Xorg and NVIDIA driver installer dependencies
  253. RUN apt-get update && apt-get install --no-install-recommends -y \
  254. kmod \
  255. libc6-dev \
  256. libpci3 \
  257. libelf-dev \
  258. pkg-config \
  259. xorg && \
  260. if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install --no-install-recommends -y libc6:i386; fi && \
  261. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  262. # Anything below this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop
  263. # Install KDE and other GUI packages
  264. ENV DESKTOP_SESSION=plasma
  265. ENV XDG_SESSION_DESKTOP=KDE
  266. ENV XDG_CURRENT_DESKTOP=KDE
  267. ENV XDG_SESSION_TYPE=x11
  268. ENV XDG_SESSION_ID="${DISPLAY#*:}"
  269. ENV KDE_FULL_SESSION=true
  270. ENV KDE_APPLICATIONS_AS_SCOPE=1
  271. ENV KWIN_COMPOSE=N
  272. ENV KWIN_X11_NO_SYNC_TO_VBLANK=1
  273. # Use sudoedit to change protected files instead of using sudo on kate
  274. ENV SUDO_EDITOR=kate
  275. # Set input to fcitx
  276. ENV GTK_IM_MODULE=fcitx
  277. ENV QT_IM_MODULE=fcitx
  278. ENV XIM=fcitx
  279. ENV XMODIFIERS="@im=fcitx"
  280. # Enable AppImage execution in containers
  281. ENV APPIMAGE_EXTRACT_AND_RUN=1
  282. RUN mkdir -pm755 /etc/apt/preferences.d && echo "Package: firefox*\n\
  283. Pin: version 1:1snap*\n\
  284. Pin-Priority: -1" > /etc/apt/preferences.d/firefox-nosnap && \
  285. 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 && \
  286. 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" && \
  287. apt-get update && apt-get install --no-install-recommends -y \
  288. kde-plasma-desktop \
  289. adwaita-icon-theme-full \
  290. appmenu-gtk3-module \
  291. ark \
  292. aspell \
  293. aspell-en \
  294. breeze \
  295. breeze-cursor-theme \
  296. breeze-gtk-theme \
  297. breeze-icon-theme \
  298. debconf-kde-helper \
  299. desktop-file-utils \
  300. dolphin \
  301. dolphin-plugins \
  302. dbus-x11 \
  303. enchant-2 \
  304. fcitx \
  305. fcitx-frontend-gtk2 \
  306. fcitx-frontend-gtk3 \
  307. fcitx-frontend-qt5 \
  308. fcitx-module-dbus \
  309. fcitx-module-kimpanel \
  310. fcitx-module-lua \
  311. fcitx-module-x11 \
  312. fcitx-tools \
  313. fcitx-hangul \
  314. fcitx-libpinyin \
  315. fcitx-m17n \
  316. fcitx-mozc \
  317. fcitx-sayura \
  318. fcitx-unikey \
  319. filelight \
  320. frameworkintegration \
  321. gwenview \
  322. haveged \
  323. hunspell \
  324. im-config \
  325. kate \
  326. kcalc \
  327. kcharselect \
  328. kdeadmin \
  329. kde-config-fcitx \
  330. kde-config-gtk-style \
  331. kde-config-gtk-style-preview \
  332. kdeconnect \
  333. kdegraphics-thumbnailers \
  334. kde-spectacle \
  335. kdf \
  336. kdialog \
  337. kget \
  338. kimageformat-plugins \
  339. kinfocenter \
  340. kio \
  341. kio-extras \
  342. kmag \
  343. kmenuedit \
  344. kmix \
  345. kmousetool \
  346. kmouth \
  347. ksshaskpass \
  348. ktimer \
  349. kwayland-integration \
  350. kwin-addons \
  351. kwin-x11 \
  352. libdbusmenu-glib4 \
  353. libdbusmenu-gtk3-4 \
  354. libgail-common \
  355. libgdk-pixbuf2.0-bin \
  356. libgtk2.0-bin \
  357. libgtk-3-bin \
  358. libkf5baloowidgets-bin \
  359. libkf5dbusaddons-bin \
  360. libkf5iconthemes-bin \
  361. libkf5kdelibs4support5-bin \
  362. libkf5khtml-bin \
  363. libkf5parts-plugins \
  364. libqt5multimedia5-plugins \
  365. librsvg2-common \
  366. media-player-info \
  367. okular \
  368. okular-extra-backends \
  369. partitionmanager \
  370. plasma-browser-integration \
  371. plasma-calendar-addons \
  372. plasma-dataengines-addons \
  373. plasma-discover \
  374. plasma-integration \
  375. plasma-runners-addons \
  376. plasma-widgets-addons \
  377. policykit-desktop-privileges \
  378. polkit-kde-agent-1 \
  379. print-manager \
  380. qapt-deb-installer \
  381. qml-module-org-kde-runnermodel \
  382. qml-module-org-kde-qqc2desktopstyle \
  383. qml-module-qtgraphicaleffects \
  384. qml-module-qtquick-xmllistmodel \
  385. qt5-gtk-platformtheme \
  386. qt5-image-formats-plugins \
  387. qt5-style-plugins \
  388. qtspeech5-flite-plugin \
  389. qtvirtualkeyboard-plugin \
  390. software-properties-qt \
  391. sonnet-plugins \
  392. sweeper \
  393. systemsettings \
  394. ubuntu-drivers-common \
  395. vlc \
  396. vlc-l10n \
  397. vlc-plugin-access-extra \
  398. vlc-plugin-notify \
  399. vlc-plugin-samba \
  400. vlc-plugin-skins2 \
  401. vlc-plugin-video-splitter \
  402. vlc-plugin-visualization \
  403. xdg-desktop-portal-kde \
  404. xdg-user-dirs \
  405. firefox \
  406. transmission-qt && \
  407. apt-get install --install-recommends -y \
  408. libreoffice \
  409. libreoffice-kf5 \
  410. libreoffice-plasma \
  411. libreoffice-style-breeze && \
  412. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  413. # Fix KDE startup permissions issues in containers
  414. 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/') && \
  415. cp -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit /tmp/ && \
  416. rm -f /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  417. cp -f /tmp/start_kdeinit /usr/lib/${MULTI_ARCH}/libexec/kf5/start_kdeinit && \
  418. rm -f /tmp/start_kdeinit && \
  419. # KDE disable screen lock, double-click to open instead of single-click
  420. echo "[Daemon]\n\
  421. Autolock=false\n\
  422. LockOnResume=false" > /etc/xdg/kscreenlockerrc && \
  423. echo "[KDE]\n\
  424. SingleClick=false\n\
  425. \n\
  426. [KDE Action Restrictions]\n\
  427. action/lock_screen=false\n\
  428. logout=false" > /etc/xdg/kdeglobals
  429. # Wine, Winetricks, Lutris, and PlayOnLinux, this process must be consistent with https://wiki.winehq.org/Ubuntu
  430. ARG WINE_BRANCH=staging
  431. RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
  432. mkdir -pm755 /etc/apt/keyrings && curl -fsSL -o /etc/apt/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  433. 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" && \
  434. apt-get update && apt-get install --install-recommends -y \
  435. winehq-${WINE_BRANCH} && \
  436. apt-get install --no-install-recommends -y \
  437. q4wine \
  438. playonlinux && \
  439. LUTRIS_VERSION="$(curl -fsSL "https://api.github.com/repos/lutris/lutris/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  440. curl -fsSL -O "https://github.com/lutris/lutris/releases/download/v${LUTRIS_VERSION}/lutris_${LUTRIS_VERSION}_all.deb" && \
  441. apt-get install --no-install-recommends -y ./lutris_${LUTRIS_VERSION}_all.deb && rm -f "./lutris_${LUTRIS_VERSION}_all.deb" && \
  442. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  443. curl -fsSL -o /usr/bin/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  444. chmod 755 /usr/bin/winetricks && \
  445. curl -fsSL -o /usr/share/bash-completion/completions/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"; fi
  446. # Install latest Selkies-GStreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application, should be consistent with Selkies-GStreamer documentation
  447. ARG PIP_BREAK_SYSTEM_PACKAGES=1
  448. RUN apt-get update && apt-get install --no-install-recommends -y \
  449. # GStreamer dependencies
  450. python3-pip \
  451. python3-dev \
  452. python3-gi \
  453. python3-setuptools \
  454. python3-wheel \
  455. libaa1 \
  456. bzip2 \
  457. libgcrypt20 \
  458. libcairo-gobject2 \
  459. libpangocairo-1.0-0 \
  460. libgdk-pixbuf2.0-0 \
  461. libsoup2.4-1 \
  462. libsoup-gnome2.4-1 \
  463. libgirepository-1.0-1 \
  464. glib-networking \
  465. libglib2.0-0 \
  466. libjson-glib-1.0-0 \
  467. libgudev-1.0-0 \
  468. alsa-utils \
  469. jackd2 \
  470. libjack-jackd2-0 \
  471. libpulse0 \
  472. libogg0 \
  473. libopus0 \
  474. libvorbis-dev \
  475. libjpeg-turbo8 \
  476. libopenjp2-7 \
  477. libvpx-dev \
  478. libwebp-dev \
  479. x264 \
  480. x265 \
  481. libdrm2 \
  482. libegl1 \
  483. libgl1 \
  484. libopengl0 \
  485. libgles1 \
  486. libgles2 \
  487. libglvnd0 \
  488. libglx0 \
  489. wayland-protocols \
  490. libwayland-dev \
  491. libwayland-egl1 \
  492. wmctrl \
  493. xsel \
  494. xdotool \
  495. x11-utils \
  496. x11-xserver-utils \
  497. xserver-xorg-core \
  498. libx11-xcb1 \
  499. libxcb-dri3-0 \
  500. libxkbcommon0 \
  501. libxdamage1 \
  502. libxfixes3 \
  503. libxv1 \
  504. libxtst6 \
  505. libxext6 && \
  506. 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 && \
  507. # Automatically fetch the latest selkies-gstreamer version and install the components
  508. SELKIES_VERSION="$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \
  509. 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 - && \
  510. 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" && \
  511. 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 - && \
  512. 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" && sudo apt-get update && sudo apt-get install --no-install-recommends -y ./selkies-js-interposer.deb && rm -f selkies-js-interposer.deb && \
  513. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/*
  514. # Add configuration for Selkies-GStreamer Joystick interposer
  515. ENV SELKIES_INTERPOSER='/usr/$LIB/selkies_joystick_interposer.so'
  516. ENV LD_PRELOAD="${SELKIES_INTERPOSER}${LD_PRELOAD:+:${LD_PRELOAD}}"
  517. ENV SDL_JOYSTICK_DEVICE=/dev/input/js0
  518. # Install the noVNC web interface and the latest x11vnc for fallback
  519. RUN apt-get update && apt-get install --no-install-recommends -y \
  520. autoconf \
  521. automake \
  522. autotools-dev \
  523. chrpath \
  524. debhelper \
  525. git \
  526. jq \
  527. python3 \
  528. python3-numpy \
  529. libc6-dev \
  530. libcairo2-dev \
  531. libjpeg-turbo8-dev \
  532. libssl-dev \
  533. libv4l-dev \
  534. libvncserver-dev \
  535. libtool-bin \
  536. libxdamage-dev \
  537. libxinerama-dev \
  538. libxrandr-dev \
  539. libxss-dev \
  540. libxtst-dev \
  541. libavahi-client-dev && \
  542. apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/debconf/* /var/log/* /tmp/* /var/tmp/* && \
  543. # Build the latest x11vnc source to avoid various errors
  544. git clone "https://github.com/LibVNC/x11vnc.git" /tmp/x11vnc && \
  545. cd /tmp/x11vnc && autoreconf -fi && ./configure && make install && cd / && rm -rf /tmp/* && \
  546. curl -fsSL "https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz" | tar -xzf - -C /opt && \
  547. mv -f "/opt/noVNC-${NOVNC_VERSION}" /opt/noVNC && \
  548. cd /opt/noVNC && ln -snf vnc.html index.html && \
  549. # Use the latest Websockify source to expose noVNC
  550. git clone "https://github.com/novnc/websockify.git" /opt/noVNC/utils/websockify
  551. # 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
  552. # Copy scripts and configurations used to start the container with `--chown=1000:1000`
  553. COPY --chown=1000:1000 entrypoint.sh /etc/entrypoint.sh
  554. RUN chmod 755 /etc/entrypoint.sh
  555. COPY --chown=1000:1000 selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  556. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  557. COPY --chown=1000:1000 supervisord.conf /etc/supervisord.conf
  558. RUN chmod 755 /etc/supervisord.conf
  559. # Configure coTURN script
  560. RUN echo "#!/bin/bash\n\
  561. set -e\n\
  562. turnserver \
  563. --verbose \
  564. --listening-ip=\"0.0.0.0\" \
  565. --listening-ip=\"::\" \
  566. --listening-port=\"\${SELKIES_TURN_PORT:-3478}\" \
  567. --realm=\"\${TURN_REALM:-example.com}\" \
  568. --external-ip=\"\${SELKIES_TURN_HOST:-\$(curl -fsSL checkip.amazonaws.com)}\" \
  569. --min-port=\"\${TURN_MIN_PORT:-49152}\" \
  570. --max-port=\"\${TURN_MAX_PORT:-65535}\" \
  571. --channel-lifetime=\"\${TURN_CHANNEL_LIFETIME:--1}\" \
  572. --lt-cred-mech \
  573. --user \"selkies:\${TURN_RANDOM_PASSWORD}\" \
  574. --no-cli \
  575. --cli-password=\"\${TURN_RANDOM_PASSWORD:-\$(tr -dc 'A-Za-z0-9' < /dev/urandom 2>/dev/null | head -c 24)}\" \
  576. --allow-loopback-peers \
  577. \${TURN_EXTRA_ARGS} \$@\
  578. " > /etc/start-turnserver.sh && chmod 755 /etc/start-turnserver.sh
  579. SHELL ["/bin/sh", "-c"]
  580. USER 0
  581. # Enable sudo through sudo-root with uid 0
  582. RUN if [ -d "/usr/libexec/sudo" ]; then SUDO_LIB="/usr/libexec/sudo"; else SUDO_LIB="/usr/lib/sudo"; fi && \
  583. 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 to sudo' && \
  584. chmod -f 4755 /usr/bin/sudo-root || echo 'Failed to set chmod to sudo-root'
  585. USER 1000
  586. ENV PIPEWIRE_LATENCY="32/48000"
  587. ENV XDG_RUNTIME_DIR=/tmp/runtime-ubuntu
  588. ENV PIPEWIRE_RUNTIME_DIR="${PIPEWIRE_RUNTIME_DIR:-${XDG_RUNTIME_DIR:-/tmp}}"
  589. ENV PULSE_RUNTIME_PATH="${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}"
  590. ENV PULSE_SERVER="${PULSE_SERVER:-unix:${PULSE_RUNTIME_PATH:-${XDG_RUNTIME_DIR:-/tmp}/pulse}/native}"
  591. USER 1000
  592. ENV SHELL=/bin/bash
  593. ENV USER=ubuntu
  594. WORKDIR /home/ubuntu
  595. EXPOSE 8080
  596. ENTRYPOINT ["/usr/bin/supervisord"]