Dockerfile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 DISPLAY :0
  13. ENV PULSE_SERVER 127.0.0.1:4713
  14. ENV XDG_RUNTIME_DIR /tmp
  15. # Default environment variables (password is "mypasswd")
  16. ENV TZ UTC
  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. adwaita-icon-theme-full \
  77. brltty \
  78. brltty-x11 \
  79. desktop-file-utils \
  80. fonts-dejavu-core \
  81. fonts-freefont-ttf \
  82. fonts-noto \
  83. fonts-noto-cjk \
  84. fonts-noto-cjk-extra \
  85. fonts-noto-color-emoji \
  86. fonts-noto-hinted \
  87. fonts-noto-mono \
  88. fonts-opensymbol \
  89. fonts-symbola \
  90. fonts-ubuntu \
  91. gucharmap \
  92. mpd \
  93. onboard \
  94. parole \
  95. policykit-desktop-privileges \
  96. libpulse0 \
  97. pulseaudio \
  98. pavucontrol \
  99. ristretto \
  100. supervisor \
  101. thunar \
  102. thunar-volman \
  103. thunar-archive-plugin \
  104. thunar-media-tags-plugin \
  105. net-tools \
  106. libgtk-3-bin \
  107. libpci3 \
  108. libelf-dev \
  109. libglvnd-dev \
  110. vainfo \
  111. vdpauinfo \
  112. pkg-config \
  113. mesa-utils \
  114. mesa-utils-extra \
  115. mesa-va-drivers \
  116. mesa-vulkan-drivers \
  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. mkdir -pm755 /etc/apt/keyrings && curl -fsSL -o /etc/apt/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. build-essential \
  208. python3-pip \
  209. python3-dev \
  210. python3-gi \
  211. python3-setuptools \
  212. python3-tk \
  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. if [ "${UBUNTU_RELEASE}" \> "20.04" ]; then apt-get install --no-install-recommends -y xcvt; fi && \
  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. if [ "${UBUNTU_RELEASE}" \> "18.04" ]; then pip3 install --upgrade --force-reinstall "https://github.com/python-xlib/python-xlib/archive/e8cf018.zip"; fi && \
  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. git \
  256. jq \
  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. git clone "https://github.com/LibVNC/x11vnc.git" /tmp/x11vnc && \
  274. cd /tmp/x11vnc && autoreconf -fi && ./configure && make install && cd / && rm -rf /tmp/* && \
  275. NOVNC_VERSION=$(curl -fsSL "https://api.github.com/repos/noVNC/noVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  276. curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  277. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  278. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  279. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  280. # Add custom packages below this comment, or use FROM in a new container and replace entrypoint.sh or supervisord.conf
  281. # Create user with password ${PASSWD}
  282. RUN apt-get update && apt-get install --no-install-recommends -y \
  283. sudo && \
  284. rm -rf /var/lib/apt/lists/* && \
  285. groupadd -g 1000 user && \
  286. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  287. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lp,lpadmin,plugdev,scanner,sudo,tape,tty,video,voice user && \
  288. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  289. chown user:user /home/user && \
  290. echo "user:${PASSWD}" | chpasswd && \
  291. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
  292. COPY entrypoint.sh /etc/entrypoint.sh
  293. RUN chmod 755 /etc/entrypoint.sh
  294. COPY selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  295. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  296. COPY supervisord.conf /etc/supervisord.conf
  297. RUN chmod 755 /etc/supervisord.conf
  298. EXPOSE 8080
  299. USER user
  300. ENV USER=user
  301. WORKDIR /home/user
  302. ENTRYPOINT ["/usr/bin/supervisord"]