Dockerfile 4.6 KB

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