Dockerfile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. FROM nvidia/opengl:1.2-glvnd-runtime-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. ENV VIDEO_PORT DFP
  14. # Install locales to prevent errors
  15. RUN apt-get clean && \
  16. apt-get update && \
  17. apt-get install --no-install-recommends -y locales && \
  18. rm -rf /var/lib/apt/lists/* && \
  19. locale-gen en_US.UTF-8
  20. ENV LANG en_US.UTF-8
  21. ENV LANGUAGE en_US:en
  22. ENV LC_ALL en_US.UTF-8
  23. # https://gitlab.com/nvidia/container-images/driver/-/blob/master/ubuntu20.04/Dockerfile
  24. RUN dpkg --add-architecture i386 && \
  25. apt-get update && apt-get install -y --no-install-recommends \
  26. apt-utils \
  27. build-essential \
  28. ca-certificates \
  29. curl \
  30. kmod \
  31. file \
  32. libc6:i386 \
  33. libelf-dev \
  34. libglvnd-dev \
  35. pkg-config && \
  36. rm -rf /var/lib/apt/lists/*
  37. # Install Xorg, MATE desktop, and others
  38. RUN apt-get update && apt-get install -y \
  39. software-properties-common \
  40. wget \
  41. gzip \
  42. zip \
  43. unzip \
  44. gcc \
  45. git \
  46. libc6-dev \
  47. libglu1 \
  48. libglu1:i386 \
  49. libsm6 \
  50. libxv1 \
  51. libxv1:i386 \
  52. make \
  53. python \
  54. python-numpy \
  55. python3 \
  56. python3-numpy \
  57. dbus-x11 \
  58. libdbus-c++-1-0v5 \
  59. x11-xkb-utils \
  60. x11-xserver-utils \
  61. xauth \
  62. xinit \
  63. xfonts-base \
  64. xkb-data \
  65. libxrandr-dev \
  66. xorg-dev \
  67. libxtst6 \
  68. libxtst6:i386 \
  69. mlocate \
  70. nano \
  71. vim \
  72. htop \
  73. firefox \
  74. libpci3 \
  75. supervisor \
  76. net-tools \
  77. ubuntu-mate-core \
  78. ubuntu-mate-desktop \
  79. mesa-utils \
  80. x11vnc \
  81. x11-apps && \
  82. # Remove Bluetooth packages that throw errors
  83. apt-get autoremove --purge -y blueman bluez bluez-cups pulseaudio-module-bluetooth && \
  84. rm -rf /var/lib/apt/lists/*
  85. # Install Vulkan and fix containerization issues
  86. RUN apt-get update && apt-get install -y --no-install-recommends \
  87. libvulkan-dev \
  88. vulkan-validationlayers-dev \
  89. vulkan-utils \
  90. meson && \
  91. rm -rf /var/lib/apt/lists/* && \
  92. cd /tmp && \
  93. git clone https://github.com/aejsmith/vkdevicechooser && \
  94. cd vkdevicechooser && \
  95. meson builddir --prefix=/usr && \
  96. meson install -C builddir && \
  97. rm -rf /tmp/*
  98. # Wine and Winetricks, comment out the below lines to disable
  99. ARG WINE_BRANCH=stable
  100. RUN curl -fsSL https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - && \
  101. apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" && \
  102. apt-get update && apt-get install -y --install-recommends winehq-${WINE_BRANCH} && \
  103. rm -rf /var/lib/apt/lists/* && \
  104. curl -fsSL -o /usr/bin/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks && \
  105. chmod 755 /usr/bin/winetricks && \
  106. curl -fsSL -o /usr/share/bash-completion/completions/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion
  107. # noVNC and Websockify
  108. ENV NOVNC_VERSION 1.2.0
  109. RUN curl -fsSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.tar.gz | tar -xzf - -C /opt && \
  110. mv /opt/noVNC-${NOVNC_VERSION} /opt/noVNC && \
  111. ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html && \
  112. git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify
  113. # Create user with password ${VNCPASS}
  114. RUN apt-get update && apt-get install -y --no-install-recommends \
  115. sudo && \
  116. rm -rf /var/lib/apt/lists/* && \
  117. groupadd -g 1000 user && \
  118. useradd -ms /bin/bash user -u 1000 -g 1000 && \
  119. usermod -a -G adm,audio,cdrom,dialout,dip,fax,floppy,input,lp,lpadmin,netdev,plugdev,render,scanner,ssh,sudo,tape,tty,video,voice user && \
  120. echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
  121. chown -R user:user /home/user && \
  122. echo "user:${VNCPASS}" | chpasswd
  123. COPY bootstrap.sh /etc/bootstrap.sh
  124. RUN chmod 755 /etc/bootstrap.sh
  125. COPY supervisord.conf /etc/supervisord.conf
  126. RUN chmod 755 /etc/supervisord.conf
  127. EXPOSE 5901
  128. USER user
  129. WORKDIR /home/user
  130. ENTRYPOINT ["/usr/bin/supervisord"]