Dockerfile 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # Ubuntu release versions 18.04 and 20.04 are supported
  2. ARG UBUNTU_RELEASE=20.04
  3. FROM nvcr.io/nvidia/cudagl:11.0.3-runtime-ubuntu${UBUNTU_RELEASE}
  4. LABEL maintainer "https://github.com/ehfd,https://github.com/danisla"
  5. ARG UBUNTU_RELEASE
  6. # Make all NVIDIA GPUs visible, but we want to manually install drivers
  7. ARG NVIDIA_VISIBLE_DEVICES=all
  8. # Supress interactive menu while installing keyboard-configuration
  9. ARG DEBIAN_FRONTEND=noninteractive
  10. ENV NVIDIA_DRIVER_CAPABILITIES all
  11. ENV PULSE_SERVER 127.0.0.1:4713
  12. # Default environment variables (password is "mypasswd")
  13. ENV TZ UTC
  14. ENV SIZEW 1920
  15. ENV SIZEH 1080
  16. ENV REFRESH 60
  17. ENV DPI 96
  18. ENV CDEPTH 24
  19. ENV VIDEO_PORT DFP
  20. ENV PASSWD mypasswd
  21. ENV NOVNC_ENABLE false
  22. ENV WEBRTC_ENCODER nvh264enc
  23. ENV WEBRTC_ENABLE_RESIZE false
  24. ENV ENABLE_AUDIO true
  25. ENV ENABLE_BASIC_AUTH true
  26. # Install locales to prevent errors
  27. RUN apt-get clean && \
  28. apt-get update && apt-get install --no-install-recommends -y locales && \
  29. rm -rf /var/lib/apt/lists/* && \
  30. locale-gen en_US.UTF-8
  31. ENV LANG en_US.UTF-8
  32. ENV LANGUAGE en_US:en
  33. ENV LC_ALL en_US.UTF-8
  34. # Install Xorg, MATE Desktop, and others
  35. RUN dpkg --add-architecture i386 && \
  36. apt-get update && apt-get install --no-install-recommends -y \
  37. software-properties-common \
  38. apt-utils \
  39. build-essential \
  40. ca-certificates \
  41. kmod \
  42. libc6:i386 \
  43. libc6-dev \
  44. curl \
  45. file \
  46. wget \
  47. gzip \
  48. zip \
  49. unzip \
  50. gcc \
  51. git \
  52. jq \
  53. make \
  54. python \
  55. python-numpy \
  56. python3 \
  57. python3-numpy \
  58. mlocate \
  59. nano \
  60. vim \
  61. htop \
  62. firefox \
  63. supervisor \
  64. net-tools \
  65. libpci3 \
  66. libelf-dev \
  67. libglvnd-dev \
  68. pkg-config \
  69. mesa-utils \
  70. mesa-utils-extra \
  71. libglu1 \
  72. libglu1:i386 \
  73. libsm6 \
  74. libxv1 \
  75. libxv1:i386 \
  76. libxtst6 \
  77. libxtst6:i386 \
  78. x11-xkb-utils \
  79. x11-xserver-utils \
  80. x11-apps \
  81. dbus-x11 \
  82. libdbus-c++-1-0v5 \
  83. xauth \
  84. xinit \
  85. xfonts-base \
  86. xkb-data \
  87. libxrandr-dev \
  88. xorg-dev && \
  89. apt-get install -y ubuntu-mate-desktop && \
  90. 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 && \
  91. # Remove Bluetooth packages that throw errors
  92. apt-get autoremove --purge -y \
  93. blueman \
  94. pulseaudio-module-bluetooth && \
  95. rm -rf /var/lib/apt/lists/*
  96. # Wine, Winetricks, and PlayOnLinux, comment out the below lines to disable
  97. ARG WINE_BRANCH=devel
  98. RUN if [ "${UBUNTU_RELEASE}" = "18.04" ]; then add-apt-repository ppa:cybermax-dexter/sdl2-backport; fi && \
  99. curl -fsSL https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - && \
  100. apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" && \
  101. apt-get update && apt-get install -y \
  102. winehq-${WINE_BRANCH} \
  103. q4wine \
  104. playonlinux && \
  105. rm -rf /var/lib/apt/lists/* && \
  106. curl -fsSL -o /usr/bin/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks && \
  107. chmod 755 /usr/bin/winetricks && \
  108. curl -fsSL -o /usr/share/bash-completion/completions/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion
  109. # Install latest selkies-gstreamer (https://github.com/selkies-project/selkies-gstreamer) build, Python application, and web application
  110. RUN apt-get update && apt-get install --no-install-recommends -y \
  111. build-essential \
  112. python3-pip \
  113. python3-dev \
  114. python3-gi \
  115. python3-setuptools \
  116. python3-wheel \
  117. tzdata \
  118. sudo \
  119. udev \
  120. xclip \
  121. x11-utils \
  122. xdotool \
  123. wmctrl \
  124. jq \
  125. gdebi-core \
  126. x11-xserver-utils \
  127. xserver-xorg-core \
  128. libopus0 \
  129. libgdk-pixbuf2.0-0 \
  130. libsrtp2-1 \
  131. libxdamage1 \
  132. libxml2-dev \
  133. libwebrtc-audio-processing1 \
  134. libcairo-gobject2 \
  135. pulseaudio \
  136. libpulse0 \
  137. libpangocairo-1.0-0 \
  138. libgirepository1.0-dev && \
  139. rm -rf /var/lib/apt/lists/* && \
  140. cd /opt && \
  141. SELKIES_VERSION=$(curl -fsSL "https://api.github.com/repos/selkies-project/selkies-gstreamer/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  142. 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 - && \
  143. 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" && \
  144. curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz" | tar -zxf - && \
  145. cd /usr/local/cuda/lib64 && sudo find . -maxdepth 1 -type l -name "*libnvrtc.so.*" -exec sh -c 'ln -sf $(basename {}) libnvrtc.so' \;
  146. # Install latest noVNC web interface for fallback
  147. RUN apt-get update && apt-get install --no-install-recommends -y \
  148. autoconf \
  149. automake \
  150. autotools-dev \
  151. chrpath \
  152. debhelper \
  153. jq \
  154. python \
  155. python-numpy \
  156. python3 \
  157. python3-numpy \
  158. libc6-dev \
  159. libcairo2-dev \
  160. libjpeg-turbo8-dev \
  161. libssl-dev \
  162. libv4l-dev \
  163. libvncserver-dev \
  164. libtool-bin \
  165. libxdamage-dev \
  166. libxinerama-dev \
  167. libxrandr-dev \
  168. libxss-dev \
  169. libxtst-dev \
  170. libavahi-client-dev && \
  171. rm -rf /var/lib/apt/lists/* && \
  172. git clone https://github.com/LibVNC/x11vnc.git /tmp/x11vnc && \
  173. cd /tmp/x11vnc && autoreconf -fi && ./configure && make install && cd / && rm -rf /tmp/* && \
  174. NOVNC_VERSION=$(curl -fsSL "https://api.github.com/repos/noVNC/noVNC/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
  175. curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  176. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  177. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  178. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  179. # Add custom packages below this comment
  180. # Create user with password ${PASSWD}
  181. RUN apt-get update && apt-get install --no-install-recommends -y \
  182. sudo && \
  183. rm -rf /var/lib/apt/lists/* && \
  184. groupadd -g 1000 user && \
  185. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  186. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lp,lpadmin,netdev,plugdev,scanner,ssh,sudo,tape,tty,video,voice user && \
  187. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  188. chown user:user /home/user && \
  189. echo "user:${PASSWD}" | chpasswd && \
  190. ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
  191. COPY entrypoint.sh /etc/entrypoint.sh
  192. RUN chmod 755 /etc/entrypoint.sh
  193. COPY selkies-gstreamer-entrypoint.sh /etc/selkies-gstreamer-entrypoint.sh
  194. RUN chmod 755 /etc/selkies-gstreamer-entrypoint.sh
  195. COPY supervisord.conf /etc/supervisord.conf
  196. RUN chmod 755 /etc/supervisord.conf
  197. EXPOSE 8080
  198. USER user
  199. ENV USER=user
  200. WORKDIR /home/user
  201. ENTRYPOINT ["/usr/bin/supervisord"]