Dockerfile 24 KB

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