Nolan35 commited on
Commit
d30a57b
·
verified ·
1 Parent(s): 93b67eb

Upload Dockerfile.txt

Browse files
Files changed (1) hide show
  1. Dockerfile.txt +95 -0
Dockerfile.txt ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG BASE_IMAGE=ubuntu:22.04
2
+ From $BASE_IMAGE
3
+
4
+ LABEL maintainer "zhengpeng ge"
5
+ MAINTAINER zhenpeng ge "https://github.com/gezp"
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+ ENV USER=ubuntu \
9
+ PASSWORD=ubuntu \
10
+ UID=1000 \
11
+ GID=1000
12
+
13
+ ENV NVIDIA_VISIBLE_DEVICES=all
14
+ ENV NVIDIA_DRIVER_CAPABILITIES=all
15
+ ENV VGL_DISPLAY=egl
16
+
17
+ ## Copy config
18
+ COPY docker_config /docker_config
19
+
20
+ ## Install and Configure OpenGL
21
+ RUN apt-get update && \
22
+ apt-get install -y --no-install-recommends \
23
+ libxau6 libxdmcp6 libxcb1 libxext6 libx11-6 \
24
+ libglvnd0 libgl1 libglx0 libegl1 libgles2 \
25
+ libglvnd-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev && \
26
+ rm -rf /var/lib/apt/lists/* && \
27
+ mkdir -p /usr/share/glvnd/egl_vendor.d/ && \
28
+ echo "{\n\
29
+ \"file_format_version\" : \"1.0.0\",\n\
30
+ \"ICD\": {\n\
31
+ \"library_path\": \"libEGL_nvidia.so.0\"\n\
32
+ }\n\
33
+ }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json
34
+
35
+ ## Install and Configure Vulkan
36
+ RUN apt-get update && \
37
+ apt-get install -y --no-install-recommends vulkan-tools && \
38
+ rm -rf /var/lib/apt/lists/* && \
39
+ VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \
40
+ mkdir -p /etc/vulkan/icd.d/ && \
41
+ echo "{\n\
42
+ \"file_format_version\" : \"1.0.0\",\n\
43
+ \"ICD\": {\n\
44
+ \"library_path\": \"libGLX_nvidia.so.0\",\n\
45
+ \"api_version\" : \"${VULKAN_API_VERSION}\"\n\
46
+ }\n\
47
+ }" > /etc/vulkan/icd.d/nvidia_icd.json
48
+
49
+ ## Install some common tools
50
+ RUN apt-get update && \
51
+ apt-get install -y sudo vim gedit locales wget curl git gnupg2 lsb-release net-tools iputils-ping mesa-utils \
52
+ openssh-server bash-completion software-properties-common python3-pip python3-numpy tmux && \
53
+ update-alternatives --install /usr/bin/python python /usr/bin/python3 2 && \
54
+ pip3 install --upgrade pip &&\
55
+ rm -rf /var/lib/apt/lists/*
56
+
57
+ ## Install desktop
58
+ RUN apt-get update && \
59
+ # add apt repo for firefox
60
+ add-apt-repository -y ppa:mozillateam/ppa &&\
61
+ mkdir -p /etc/apt/preferences.d &&\
62
+ echo "Package: firefox*\n\
63
+ Pin: release o=LP-PPA-mozillateam\n\
64
+ Pin-Priority: 1001" > /etc/apt/preferences.d/mozilla-firefox &&\
65
+ # install xfce4 and firefox
66
+ apt-get install -y xfce4 terminator fonts-wqy-zenhei ffmpeg firefox &&\
67
+ # remove and disable screensaver
68
+ apt-get remove -y xfce4-screensaver --purge &&\
69
+ # set firefox as default web browser
70
+ update-alternatives --set x-www-browser /usr/bin/firefox &&\
71
+ rm -rf /var/lib/apt/lists/*
72
+
73
+ ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
74
+ RUN apt-get update && apt-get install -y pulseaudio && mkdir -p /var/run/dbus &&\
75
+ rm -rf /var/lib/apt/lists/*
76
+
77
+ ## Install nomachine
78
+ RUN bash /docker_config/install_nomachine.sh &&\
79
+ groupmod -g 2000 nx &&\
80
+ sed -i "s|#EnableClipboard both|EnableClipboard both |g" /usr/NX/etc/server.cfg &&\
81
+ sed -i '/DefaultDesktopCommand/c\DefaultDesktopCommand "xset s off && /usr/bin/startxfce4"' /usr/NX/etc/node.cfg &&\
82
+ # config pulseaudio
83
+ cp -R /etc/pulse/* /usr/NX/share/audio/ &&\
84
+ sed -i '/AudioInterface pipewire/c\AudioInterface pulseaudio' /usr/NX/etc/node.cfg &&\
85
+ sed -i '/CommandStartPulseAudio/c\CommandStartPulseAudio "/usr/bin/pulseaudio --high-priority=no"' /usr/NX/etc/node.cfg
86
+
87
+ ## Configure ssh
88
+ RUN mkdir /var/run/sshd && \
89
+ echo 'root:THEPASSWORDYOUCREATED' | chpasswd && \
90
+ sed -i 's/#*PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config && \
91
+ sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
92
+
93
+ EXPOSE 22 4000
94
+
95
+ ENTRYPOINT ["/docker_config/entrypoint.sh"]