Dockerfile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. python \
  66. python-numpy \
  67. python3 \
  68. python3-cups \
  69. python3-numpy \
  70. mlocate \
  71. nano \
  72. vim \
  73. htop \
  74. firefox \
  75. transmission-gtk \
  76. qpdfview \
  77. xarchiver \
  78. brltty \
  79. brltty-x11 \
  80. desktop-file-utils \
  81. fonts-dejavu-core \
  82. fonts-freefont-ttf \
  83. fonts-noto \
  84. fonts-noto-cjk \
  85. fonts-noto-cjk-extra \
  86. fonts-noto-color-emoji \
  87. fonts-noto-hinted \
  88. fonts-noto-mono \
  89. fonts-opensymbol \
  90. fonts-symbola \
  91. fonts-ubuntu \
  92. gucharmap \
  93. mpd \
  94. onboard \
  95. orage \
  96. parole \
  97. policykit-desktop-privileges \
  98. libpulse0 \
  99. pulseaudio \
  100. pavucontrol \
  101. ristretto \
  102. supervisor \
  103. thunar \
  104. thunar-volman \
  105. thunar-archive-plugin \
  106. thunar-media-tags-plugin \
  107. net-tools \
  108. libgtk-3-bin \
  109. libpci3 \
  110. libelf-dev \
  111. libglvnd-dev \
  112. vainfo \
  113. vdpauinfo \
  114. pkg-config \
  115. mesa-utils \
  116. mesa-utils-extra \
  117. libglu1 \
  118. libglu1:i386 \
  119. libsm6 \
  120. libxv1 \
  121. libxv1:i386 \
  122. libxtst6 \
  123. libxtst6:i386 \
  124. xdg-utils \
  125. x11-xkb-utils \
  126. x11-xserver-utils \
  127. x11-utils \
  128. x11-apps \
  129. dbus-x11 \
  130. libdbus-c++-1-0v5 \
  131. dmz-cursor-theme \
  132. numlockx \
  133. xauth \
  134. xcursor-themes \
  135. xinit \
  136. xfonts-base \
  137. xkb-data \
  138. libxrandr-dev \
  139. xorg \
  140. xubuntu-artwork \
  141. xfburn \
  142. xfpanel-switch \
  143. xfce4 \
  144. xfdesktop4 \
  145. xfwm4 \
  146. xfce4-appfinder \
  147. xfce4-clipman \
  148. xfce4-dict \
  149. xfce4-goodies \
  150. xfce4-notes \
  151. xfce4-notifyd \
  152. xfce4-panel \
  153. xfce4-screenshooter \
  154. xfce4-session \
  155. xfce4-settings \
  156. xfce4-taskmanager \
  157. xfce4-terminal \
  158. xfce4-appmenu-plugin \
  159. xfce4-battery-plugin \
  160. xfce4-clipman-plugin \
  161. xfce4-cpufreq-plugin \
  162. xfce4-cpugraph-plugin \
  163. xfce4-diskperf-plugin \
  164. xfce4-datetime-plugin \
  165. xfce4-fsguard-plugin \
  166. xfce4-genmon-plugin \
  167. xfce4-indicator-plugin \
  168. xfce4-mpc-plugin \
  169. xfce4-mount-plugin \
  170. xfce4-netload-plugin \
  171. xfce4-notes-plugin \
  172. xfce4-places-plugin \
  173. xfce4-pulseaudio-plugin \
  174. xfce4-sensors-plugin \
  175. xfce4-smartbookmark-plugin \
  176. xfce4-statusnotifier-plugin \
  177. xfce4-systemload-plugin \
  178. xfce4-timer-plugin \
  179. xfce4-verve-plugin \
  180. xfce4-weather-plugin \
  181. xfce4-whiskermenu-plugin \
  182. xfce4-xkb-plugin && \
  183. apt-get install -y libreoffice && \
  184. cp -rf /etc/xdg/xfce4/panel/default.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml && \
  185. 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 && \
  186. # Support libva and VA-API through NVIDIA VDPAU
  187. 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/* && \
  188. rm -rf /var/lib/apt/lists/*
  189. # Wine, Winetricks, and PlayOnLinux, comment out the below lines to disable
  190. ARG WINE_BRANCH=devel
  191. RUN if [ "${UBUNTU_RELEASE}" = "18.04" ]; then add-apt-repository ppa:cybermax-dexter/sdl2-backport; fi && \
  192. curl -fsSL -o /usr/share/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key" && \
  193. 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" && \
  194. add-apt-repository ppa:lutris-team/lutris && \
  195. apt-get update && apt-get install --install-recommends -y \
  196. winehq-${WINE_BRANCH} && \
  197. apt-get update && apt-get install --no-install-recommends -y \
  198. lutris \
  199. q4wine \
  200. playonlinux && \
  201. rm -rf /var/lib/apt/lists/* && \
  202. curl -fsSL -o /usr/bin/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && \
  203. chmod 755 /usr/bin/winetricks && \
  204. curl -fsSL -o /usr/share/bash-completion/completions/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"
  205. # Install latest selkies-gstreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application
  206. RUN apt-get update && apt-get install --no-install-recommends -y \
  207. adwaita-icon-theme-full \
  208. build-essential \
  209. python3-pip \
  210. python3-dev \
  211. python3-gi \
  212. python3-setuptools \
  213. python3-wheel \
  214. tzdata \
  215. sudo \
  216. udev \
  217. xclip \
  218. x11-utils \
  219. xdotool \
  220. wmctrl \
  221. jq \
  222. gdebi-core \
  223. x11-xserver-utils \
  224. xserver-xorg-core \
  225. libopus0 \
  226. libgdk-pixbuf2.0-0 \
  227. libsrtp2-1 \
  228. libxdamage1 \
  229. libxml2-dev \
  230. libwebrtc-audio-processing1 \
  231. libcairo-gobject2 \
  232. pulseaudio \
  233. libpulse0 \
  234. libpangocairo-1.0-0 \
  235. libgirepository1.0-dev \
  236. libjpeg-dev \
  237. zlib1g-dev \
  238. x264 && \
  239. rm -rf /var/lib/apt/lists/* && \
  240. cd /opt && \
  241. SELKIES_VERSION=$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  242. 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 - && \
  243. 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" && \
  244. pip3 install -e "git+https://github.com/selkies-project/python-xlib.git@add-xfixes-cursor#egg=python-xlib" && \
  245. curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz" | tar -zxf - && \
  246. cd /usr/local/cuda/lib64 && sudo find . -maxdepth 1 -type l -name "*libnvrtc.so.*" -exec sh -c 'ln -sf $(basename {}) libnvrtc.so' \;
  247. # Install latest noVNC web interface for fallback
  248. RUN apt-get update && apt-get install --no-install-recommends -y \
  249. autoconf \
  250. automake \
  251. autotools-dev \
  252. chrpath \
  253. debhelper \
  254. jq \
  255. python \
  256. python-numpy \
  257. python3 \
  258. python3-numpy \
  259. libc6-dev \
  260. libcairo2-dev \
  261. libjpeg-turbo8-dev \
  262. libssl-dev \
  263. libv4l-dev \
  264. libvncserver-dev \
  265. libtool-bin \
  266. libxdamage-dev \
  267. libxinerama-dev \
  268. libxrandr-dev \
  269. libxss-dev \
  270. libxtst-dev \
  271. libavahi-client-dev && \
  272. rm -rf /var/lib/apt/lists/* && \
  273. X11VNC_VERSION=$(curl -fsSL "https://api.github.com/repos/LibVNC/x11vnc/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  274. curl -fsSL https://github.com/LibVNC/x11vnc/archive/${X11VNC_VERSION}.tar.gz | tar -xzf - -C /tmp && \
  275. cd /tmp/x11vnc-${X11VNC_VERSION} && autoreconf -fi && ./configure && make install && cd / && rm -rf /tmp/* && \
  276. NOVNC_VERSION=$(curl -fsSL "https://api.github.com/repos/noVNC/noVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  277. curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  278. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  279. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  280. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  281. # Add custom packages below this comment, or use FROM in a new container and replace entrypoint.sh or supervisord.conf
  282. # Create user with password ${PASSWD}
  283. RUN apt-get update && apt-get install --no-install-recommends -y \
  284. sudo && \
  285. rm -rf /var/lib/apt/lists/* && \
  286. groupadd -g 1000 user && \
  287. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  288. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lp,lpadmin,plugdev,scanner,sudo,tape,tty,video,voice user && \
  289. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  290. chown user:user /home/user && \
  291. echo "user:${PASSWD}" | chpasswd && \
  292. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
  293. COPY entrypoint.sh /etc/entrypoint.sh
  294. RUN chmod 755 /etc/entrypoint.sh
  295. COPY selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  296. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  297. COPY supervisord.conf /etc/supervisord.conf
  298. RUN chmod 755 /etc/supervisord.conf
  299. EXPOSE 8080
  300. USER user
  301. ENV USER=user
  302. WORKDIR /home/user
  303. ENTRYPOINT ["/usr/bin/supervisord"]