Dockerfile 11 KB

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