Dockerfile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. FROM nvidia/opengl:1.2-glvnd-devel-ubuntu20.04
  2. LABEL maintainer "https://github.com/ehfd"
  3. # Make all NVIDIA GPUS visible, but we want to manually install drivers
  4. ARG NVIDIA_VISIBLE_DEVICES=all
  5. # Supress interactive menu while installing keyboard-configuration
  6. ARG DEBIAN_FRONTEND=noninteractive
  7. ENV NVIDIA_DRIVER_CAPABILITIES all
  8. # Default options (password is 'vncpasswd')
  9. ENV VNCPASS vncpasswd
  10. ENV SIZEW 1920
  11. ENV SIZEH 1080
  12. ENV CDEPTH 24
  13. # Install locales to prevent errors
  14. RUN apt-get clean && \
  15. apt-get update && \
  16. apt-get install --no-install-recommends -y locales && \
  17. rm -rf /var/lib/apt/lists/* && \
  18. locale-gen en_US.UTF-8
  19. ENV LANG en_US.UTF-8
  20. ENV LANGUAGE en_US:en
  21. ENV LC_ALL en_US.UTF-8
  22. # https://gitlab.com/nvidia/container-images/driver/-/blob/master/ubuntu20.04/Dockerfile
  23. RUN dpkg --add-architecture i386 && \
  24. apt-get update && apt-get install -y --no-install-recommends \
  25. apt-utils \
  26. build-essential \
  27. ca-certificates \
  28. curl \
  29. kmod \
  30. file \
  31. libc6:i386 \
  32. libelf-dev \
  33. libglvnd-dev \
  34. pkg-config && \
  35. rm -rf /var/lib/apt/lists/*
  36. # Install Xorg and desktop packages
  37. RUN apt-get update && apt-get install -y \
  38. software-properties-common \
  39. wget \
  40. gzip \
  41. zip \
  42. unzip \
  43. gcc \
  44. git \
  45. libc6-dev \
  46. libglu1 \
  47. libglu1:i386 \
  48. libsm6 \
  49. libxv1 \
  50. libxv1:i386 \
  51. make \
  52. python \
  53. python-numpy \
  54. python3 \
  55. python3-numpy \
  56. x11-xkb-utils \
  57. x11-xserver-utils \
  58. xauth \
  59. xinit \
  60. xfonts-base \
  61. xkb-data \
  62. libxrandr-dev \
  63. xorg-dev \
  64. libxtst6 \
  65. libxtst6:i386 \
  66. mlocate \
  67. nano \
  68. vim \
  69. htop \
  70. firefox \
  71. libpci3 \
  72. supervisor \
  73. net-tools \
  74. ubuntu-mate-core \
  75. ubuntu-mate-desktop \
  76. mesa-utils \
  77. x11vnc \
  78. x11-apps && \
  79. rm -rf /var/lib/apt/lists/*
  80. # Install Vulkan
  81. RUN apt-get update && apt-get install -y --no-install-recommends \
  82. libvulkan-dev \
  83. vulkan-validationlayers-dev \
  84. vulkan-utils \
  85. meson && \
  86. rm -rf /var/lib/apt/lists/* && \
  87. cd /tmp && \
  88. git clone https://github.com/aejsmith/vkdevicechooser && \
  89. cd vkdevicechooser && \
  90. meson builddir --prefix=/usr && \
  91. meson install -C builddir && \
  92. rm -rf /tmp/*
  93. # Sound driver including PulseAudio and GTK library
  94. # If you want to use sounds on docker, try 'pulseaudio --start'
  95. RUN apt-get update && apt-get install -y --no-install-recommends \
  96. alsa \
  97. pulseaudio \
  98. libgtk2.0-0 && \
  99. rm -rf /var/lib/apt/lists/*
  100. # noVNC and Websockify
  101. ENV NOVNC_VERSION 1.2.0
  102. RUN curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  103. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  104. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  105. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  106. # Xorg segfault error mitigation
  107. RUN apt-get update && apt-get install -y --no-install-recommends \
  108. dbus-x11 \
  109. libdbus-c++-1-0v5 && \
  110. rm -rf /var/lib/apt/lists/*
  111. # Create user with password ${VNCPASS}
  112. RUN apt-get update && apt-get install -y --no-install-recommends \
  113. sudo && \
  114. rm -rf /var/lib/apt/lists/* && \
  115. groupadd -g 1000 user && \
  116. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  117. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lpadmin,netdev,plugdev,render,scanner,ssh,sudo,tape,tty,video,voice user && \
  118. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  119. chown -R user:user /home/user && \
  120. echo "user:${VNCPASS}" | chpasswd
  121. COPY bootstrap.sh /bootstrap.sh
  122. RUN chmod 755 /bootstrap.sh
  123. COPY supervisord.conf /etc/supervisord.conf
  124. RUN chmod 755 /etc/supervisord.conf
  125. EXPOSE 5901
  126. USER user
  127. WORKDIR /home/user
  128. ENTRYPOINT ["/usr/bin/supervisord"]