Dockerfile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. FROM ubuntu:20.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 -o APT::Immediate-Configure=false -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. xauth \
  58. xinit \
  59. xfonts-base \
  60. xkb-data \
  61. libxtst6 \
  62. libxtst6:i386 \
  63. mlocate \
  64. nano \
  65. vim \
  66. htop \
  67. firefox \
  68. libpci3 \
  69. supervisor \
  70. net-tools \
  71. ubuntu-mate-core \
  72. ubuntu-mate-desktop \
  73. mesa-utils \
  74. x11vnc \
  75. x11-apps && \
  76. rm -rf /var/lib/apt/lists/*
  77. # Install Vulkan
  78. RUN apt-get update && apt-get install -y --no-install-recommends \
  79. libvulkan-dev \
  80. vulkan-validationlayers-dev \
  81. vulkan-utils \
  82. meson && \
  83. rm -rf /var/lib/apt/lists/* && \
  84. cd /tmp && \
  85. git clone https://github.com/aejsmith/vkdevicechooser && \
  86. cd vkdevicechooser && \
  87. meson builddir --prefix=/usr && \
  88. meson install -C builddir && \
  89. rm -rf /tmp/*
  90. # Sound driver including PulseAudio and GTK library
  91. # If you want to use sounds on docker, try 'pulseaudio --start'
  92. RUN apt-get update && apt-get install -y --no-install-recommends \
  93. alsa \
  94. pulseaudio \
  95. libgtk2.0-0 && \
  96. rm -rf /var/lib/apt/lists/*
  97. # noVNC and Websockify
  98. ENV NOVNC_VERSION 1.2.0
  99. RUN curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  100. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  101. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  102. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  103. # Xorg segfault error mitigation
  104. RUN apt-get update && apt-get install -y --no-install-recommends \
  105. dbus-x11 \
  106. libdbus-c++-1-0v5 && \
  107. rm -rf /var/lib/apt/lists/*
  108. # Create user with password ${VNCPASS}
  109. RUN apt-get update && apt-get install -y --no-install-recommends \
  110. sudo && \
  111. rm -rf /var/lib/apt/lists/* && \
  112. groupadd -g 1000 user && \
  113. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  114. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lpadmin,netdev,plugdev,render,scanner,ssh,sudo,tape,tty,video,voice user && \
  115. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  116. chown -R user:user /home/user && \
  117. echo "user:${VNCPASS}" | chpasswd
  118. COPY bootstrap.sh /bootstrap.sh
  119. RUN chmod 755 /bootstrap.sh
  120. COPY supervisord.conf /etc/supervisord.conf
  121. RUN chmod 755 /etc/supervisord.conf
  122. EXPOSE 5901
  123. USER user
  124. WORKDIR /home/user
  125. ENTRYPOINT ["/usr/bin/supervisord"]