Dockerfile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. # Ubuntu release versions 18.04 and 20.04 are supported
  2. ARG UBUNTU_RELEASE=20.04
  3. ARG CUDA_VERSION=11.2.2
  4. FROM nvcr.io/nvidia/cudagl:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_RELEASE}
  5. LABEL maintainer "https://github.com/ehfd,https://github.com/danisla"
  6. ARG UBUNTU_RELEASE
  7. ARG CUDA_VERSION
  8. # Make all NVIDIA GPUs visible, but we want to manually install drivers
  9. ARG NVIDIA_VISIBLE_DEVICES=all
  10. ARG DEBIAN_FRONTEND=noninteractive
  11. ENV NVIDIA_DRIVER_CAPABILITIES all
  12. ENV PULSE_SERVER 127.0.0.1:4713
  13. ENV XDG_RUNTIME_DIR /tmp
  14. # Default environment variables (password is "mypasswd")
  15. ENV TZ UTC
  16. ENV DISPLAY :0
  17. ENV SIZEW 1920
  18. ENV SIZEH 1080
  19. ENV REFRESH 60
  20. ENV DPI 96
  21. ENV CDEPTH 24
  22. ENV VIDEO_PORT DFP
  23. ENV PASSWD mypasswd
  24. ENV NOVNC_ENABLE false
  25. ENV WEBRTC_ENCODER nvh264enc
  26. ENV WEBRTC_ENABLE_RESIZE false
  27. ENV ENABLE_AUDIO true
  28. ENV ENABLE_BASIC_AUTH true
  29. # Install locales to prevent errors
  30. RUN apt-get clean && \
  31. apt-get update && apt-get install --no-install-recommends -y locales && \
  32. rm -rf /var/lib/apt/lists/* && \
  33. locale-gen en_US.UTF-8
  34. ENV LANG en_US.UTF-8
  35. ENV LANGUAGE en_US:en
  36. ENV LC_ALL en_US.UTF-8
  37. # Install Xorg, Xfce Desktop, and others
  38. RUN dpkg --add-architecture i386 && \
  39. apt-get update && apt-get install --no-install-recommends -y \
  40. software-properties-common \
  41. apt-transport-https \
  42. apt-utils \
  43. build-essential \
  44. ca-certificates \
  45. kmod \
  46. libc6:i386 \
  47. libc6-dev \
  48. cups-filters \
  49. cups-common \
  50. cups-pdf \
  51. curl \
  52. file \
  53. wget \
  54. bzip2 \
  55. gzip \
  56. p7zip-full \
  57. xz-utils \
  58. zip \
  59. unzip \
  60. zstd \
  61. gcc \
  62. git \
  63. jq \
  64. make \
  65. python3 \
  66. python3-cups \
  67. python3-numpy \
  68. mlocate \
  69. nano \
  70. vim \
  71. htop \
  72. firefox \
  73. transmission-gtk \
  74. qpdfview \
  75. xarchiver \
  76. brltty \
  77. brltty-x11 \
  78. desktop-file-utils \
  79. fonts-dejavu-core \
  80. fonts-freefont-ttf \
  81. fonts-noto \
  82. fonts-noto-cjk \
  83. fonts-noto-cjk-extra \
  84. fonts-noto-color-emoji \
  85. fonts-noto-hinted \
  86. fonts-noto-mono \
  87. fonts-opensymbol \
  88. fonts-symbola \
  89. fonts-ubuntu \
  90. gucharmap \
  91. mpd \
  92. onboard \
  93. parole \
  94. policykit-desktop-privileges \
  95. libpulse0 \
  96. pulseaudio \
  97. pavucontrol \
  98. ristretto \
  99. supervisor \
  100. thunar \
  101. thunar-volman \
  102. thunar-archive-plugin \
  103. thunar-media-tags-plugin \
  104. net-tools \
  105. libgtk-3-bin \
  106. libpci3 \
  107. libelf-dev \
  108. libglvnd-dev \
  109. vainfo \
  110. vdpauinfo \
  111. pkg-config \
  112. mesa-utils \
  113. mesa-utils-extra \
  114. libglu1 \
  115. libglu1:i386 \
  116. libsm6 \
  117. libxv1 \
  118. libxv1:i386 \
  119. libxtst6 \
  120. libxtst6:i386 \
  121. xdg-utils \
  122. x11-xkb-utils \
  123. x11-xserver-utils \
  124. x11-utils \
  125. x11-apps \
  126. dbus-x11 \
  127. libdbus-c++-1-0v5 \
  128. dmz-cursor-theme \
  129. numlockx \
  130. xauth \
  131. xcursor-themes \
  132. xinit \
  133. xfonts-base \
  134. xkb-data \
  135. libxrandr-dev \
  136. xorg \
  137. xubuntu-artwork \
  138. xfburn \
  139. xfpanel-switch \
  140. xfce4 \
  141. xfdesktop4 \
  142. xfwm4 \
  143. xfce4-appfinder \
  144. xfce4-clipman \
  145. xfce4-dict \
  146. xfce4-goodies \
  147. xfce4-notes \
  148. xfce4-notifyd \
  149. xfce4-panel \
  150. xfce4-screenshooter \
  151. xfce4-session \
  152. xfce4-settings \
  153. xfce4-taskmanager \
  154. xfce4-terminal \
  155. xfce4-appmenu-plugin \
  156. xfce4-battery-plugin \
  157. xfce4-clipman-plugin \
  158. xfce4-cpufreq-plugin \
  159. xfce4-cpugraph-plugin \
  160. xfce4-diskperf-plugin \
  161. xfce4-datetime-plugin \
  162. xfce4-fsguard-plugin \
  163. xfce4-genmon-plugin \
  164. xfce4-indicator-plugin \
  165. xfce4-mpc-plugin \
  166. xfce4-mount-plugin \
  167. xfce4-netload-plugin \
  168. xfce4-notes-plugin \
  169. xfce4-places-plugin \
  170. xfce4-pulseaudio-plugin \
  171. xfce4-sensors-plugin \
  172. xfce4-smartbookmark-plugin \
  173. xfce4-statusnotifier-plugin \
  174. xfce4-systemload-plugin \
  175. xfce4-timer-plugin \
  176. xfce4-verve-plugin \
  177. xfce4-weather-plugin \
  178. xfce4-whiskermenu-plugin \
  179. xfce4-xkb-plugin && \
  180. apt-get install -y libreoffice && \
  181. cp -rf /etc/xdg/xfce4/panel/default.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml && \
  182. if [ "${UBUNTU_RELEASE}" = "18.04" ]; then apt-get install --no-install-recommends -y vulkan-utils; else apt-get install --no-install-recommends -y vulkan-tools; fi && \
  183. # Support libva and VA-API through NVIDIA VDPAU
  184. curl -fsSL -o /tmp/vdpau-va-driver.deb "https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-dev/+files/vdpau-va-driver_0.7.4-6ubuntu2~ppa1~18.04.1_amd64.deb" && apt-get install --no-install-recommends -y /tmp/vdpau-va-driver.deb && rm -rf /tmp/* && \
  185. rm -rf /var/lib/apt/lists/*
  186. # Wine, Winetricks, and PlayOnLinux, comment out the below lines to disable
  187. ARG WINE_BRANCH=devel
  188. RUN if [ "${UBUNTU_RELEASE}" = "18.04" ]; then add-apt-repository ppa:cybermax-dexter/sdl2-backport; fi && \
  189. curl -fsSL -o /usr/share/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  190. curl -fsSL -o "/etc/apt/sources.list.d/winehq-$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2).sources" "https://dl.winehq.org/wine-builds/ubuntu/dists/$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2)/winehq-$(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2).sources" && \
  191. add-apt-repository ppa:lutris-team/lutris && \
  192. apt-get update && apt-get install --install-recommends -y \
  193. winehq-${WINE_BRANCH} && \
  194. apt-get update && apt-get install --no-install-recommends -y \
  195. lutris \
  196. q4wine \
  197. playonlinux && \
  198. rm -rf /var/lib/apt/lists/* && \
  199. curl -fsSL -o /usr/bin/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  200. chmod 755 /usr/bin/winetricks && \
  201. curl -fsSL -o /usr/share/bash-completion/completions/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"
  202. # Install latest selkies-gstreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application
  203. RUN apt-get update && apt-get install --no-install-recommends -y \
  204. adwaita-icon-theme-full \
  205. build-essential \
  206. python3-pip \
  207. python3-dev \
  208. python3-gi \
  209. python3-setuptools \
  210. python3-wheel \
  211. tzdata \
  212. sudo \
  213. udev \
  214. xclip \
  215. x11-utils \
  216. xdotool \
  217. wmctrl \
  218. jq \
  219. gdebi-core \
  220. x11-xserver-utils \
  221. xserver-xorg-core \
  222. libopus0 \
  223. libgdk-pixbuf2.0-0 \
  224. libsrtp2-1 \
  225. libxdamage1 \
  226. libxml2-dev \
  227. libwebrtc-audio-processing1 \
  228. libcairo-gobject2 \
  229. pulseaudio \
  230. libpulse0 \
  231. libpangocairo-1.0-0 \
  232. libgirepository1.0-dev \
  233. libjpeg-dev \
  234. zlib1g-dev \
  235. x264 && \
  236. if [ "${UBUNTU_RELEASE}" \> "20.04" ]; then apt-get install --no-install-recommends -y xcvt; fi && \
  237. rm -rf /var/lib/apt/lists/* && \
  238. cd /opt && \
  239. SELKIES_VERSION=$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  240. curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-v${SELKIES_VERSION}-ubuntu${UBUNTU_RELEASE}.tgz" | tar -zxf - && \
  241. 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 "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && rm -f "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && \
  242. if [ "${UBUNTU_RELEASE}" \> "18.04" ]; then pip3 install -e "git+https://github.com/selkies-project/python-xlib.git@add-xfixes-cursor#egg=python-xlib"; fi && \
  243. curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz" | tar -zxf - && \
  244. cd /usr/local/cuda/lib64 && sudo find . -maxdepth 1 -type l -name "*libnvrtc.so.*" -exec sh -c 'ln -sf $(basename {}) libnvrtc.so' \;
  245. # Install latest noVNC web interface for fallback
  246. RUN apt-get update && apt-get install --no-install-recommends -y \
  247. autoconf \
  248. automake \
  249. autotools-dev \
  250. chrpath \
  251. debhelper \
  252. git \
  253. jq \
  254. python3 \
  255. python3-numpy \
  256. libc6-dev \
  257. libcairo2-dev \
  258. libjpeg-turbo8-dev \
  259. libssl-dev \
  260. libv4l-dev \
  261. libvncserver-dev \
  262. libtool-bin \
  263. libxdamage-dev \
  264. libxinerama-dev \
  265. libxrandr-dev \
  266. libxss-dev \
  267. libxtst-dev \
  268. libavahi-client-dev && \
  269. rm -rf /var/lib/apt/lists/* && \
  270. git clone "https://github.com/LibVNC/x11vnc.git" /tmp/x11vnc && \
  271. cd /tmp/x11vnc && autoreconf -fi && ./configure && make install && cd / && rm -rf /tmp/* && \
  272. NOVNC_VERSION=$(curl -fsSL "https://api.github.com/repos/noVNC/noVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  273. curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  274. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  275. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  276. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  277. # Add custom packages below this comment, or use FROM in a new container and replace entrypoint.sh or supervisord.conf
  278. # Create user with password ${PASSWD}
  279. RUN apt-get update && apt-get install --no-install-recommends -y \
  280. sudo && \
  281. rm -rf /var/lib/apt/lists/* && \
  282. groupadd -g 1000 user && \
  283. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  284. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lp,lpadmin,plugdev,scanner,sudo,tape,tty,video,voice user && \
  285. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  286. chown user:user /home/user && \
  287. echo "user:${PASSWD}" | chpasswd && \
  288. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
  289. COPY entrypoint.sh /etc/entrypoint.sh
  290. RUN chmod 755 /etc/entrypoint.sh
  291. COPY selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  292. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  293. COPY supervisord.conf /etc/supervisord.conf
  294. RUN chmod 755 /etc/supervisord.conf
  295. EXPOSE 8080
  296. USER user
  297. ENV USER=user
  298. WORKDIR /home/user
  299. ENTRYPOINT ["/usr/bin/supervisord"]