-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-webos-gpu
166 lines (148 loc) · 5.55 KB
/
dockerfile-webos-gpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
ARG BASE_IMAGE="nvidia/cuda:12.6.1-cudnn-runtime-ubuntu24.04"
FROM $BASE_IMAGE AS base_image
ARG CONFIG_DIR_SRC="/dockerconfig"
ARG DEBIAN_FRONTEND=noninteractive
ARG USER=admin
# Set timezone
ENV LANGUAGE=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV TZ=Etc/UTC
# Install build tools
RUN apt-get update && \
apt-get install -y \
apt-utils \
ca-certificates \
curl \
wget \
git \
gnupg2
# Add user
RUN adduser $USER --disabled-password --gecos ''
RUN apt-get install -y sudo && \
echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$USER && \
chmod 440 /etc/sudoers.d/$USER
# Install desktop services
RUN apt-get install -y \
dbus-x11 \
libdbus-glib-1-2 \
libpulse-dev \
vlc \
xfce4 \
xfce4-terminal && \
apt-get remove -y \
light-locker \
light-locker-settings && \
rm -f /etc/xdg/autostart/light-locker.desktop \
/etc/xdg/autostart/xscreensaver.desktop
COPY $CONFIG_DIR_SRC/xfce4-screensaver.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-screensaver.xml
COPY $CONFIG_DIR_SRC/xfce4-power-manager.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
# Install language support
RUN apt-get install -y \
language-pack-zh* \
fonts-droid-fallback \
ttf-wqy-zenhei \
ttf-wqy-microhei \
fonts-arphic-ukai \
fonts-arphic-uming
# Install kasmvncserver
RUN KASMVNC_RELEASE=$(curl -sX GET "https://api.github.com/repos/kasmtech/KasmVNC/releases/latest" | \
awk '/tag_name/{print $4;exit}' FS='[""]') && \
SYSTEM_VERSION=$(grep VERSION_CODENAME /etc/os-release | cut -d'=' -f2) && \
wget https://github.com/kasmtech/KasmVNC/releases/download/${KASMVNC_RELEASE}/kasmvncserver_${SYSTEM_VERSION}_${KASMVNC_RELEASE#v}_amd64.deb && \
apt-get install -y ./kasmvncserver_*.deb && \
usermod -aG ssl-cert $USER && \
rm -rf kasmvncserver_*.deb
# Add filebrower and sound service
COPY $CONFIG_DIR_SRC/webos.conf /etc/nginx/sites-available/webos
COPY $CONFIG_DIR_SRC/set-title.sh /tmp/set-title.sh
RUN apt-get install -y \
nginx \
nodejs \
npm && \
# KCLIENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/kclient/releases/latest" | \
# awk '/tag_name/{print $4;exit}' FS='[""]') && \
KCLIENT_RELEASE=0.3.10 && \
curl -o /tmp/kclient.tar.gz -L "https://github.com/linuxserver/kclient/archive/${KCLIENT_RELEASE}.tar.gz" && \
mkdir -p /usr/local/lib/kclient && \
tar xzf /tmp/kclient.tar.gz -C /usr/local/lib/kclient/ --strip-components=1 && \
cd /usr/local/lib/kclient && \
bash /tmp/set-title.sh && \
npm install && \
rm -f package-lock.json
COPY $CONFIG_DIR_SRC/favicon.ico /usr/local/lib/kclient/public/favicon.ico
COPY $CONFIG_DIR_SRC/icon.png /usr/local/lib/kclient/public/icon.png
# Install SSH server
RUN apt-get install -y \
openssh-server && \
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
# Install Docker and NVIDIA runtime
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \
gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \
curl -sL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
apt-get update && \
apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin \
nvidia-container-runtime
COPY $CONFIG_DIR_SRC/daemon.json /etc/docker/daemon.json
RUN sed -i "s/\$HOME/$(echo /home/$USER | sed 's/\//\\&/g')/" /etc/docker/daemon.json
# Install vscode and edge
RUN curl https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor > microsoft.gpg && \
install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/microsoft-vscode.list' && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge.list' && \
rm microsoft.gpg && \
apt-get update && \
apt-get install -y code && \
apt-get install -y microsoft-edge-stable
# Install JetBrains Toolbox
COPY $CONFIG_DIR_SRC/jetbrains-toolbox.sh jetbrains-toolbox.sh
RUN apt-get install -y \
libfuse2 \
libxi6 \
libxrender1 \
libxtst6 \
mesa-utils \
libfontconfig \
libgtk-3-bin && \
bash jetbrains-toolbox.sh && \
rm -f jetbrains-toolbox.sh
COPY $CONFIG_DIR_SRC/jetbrains-toolbox.svg /usr/local/share/JetBrains/Toolbox/jetbrains-toolbox.svg
COPY $CONFIG_DIR_SRC/jetbrains-toolbox.desktop /usr/local/share/JetBrains/Toolbox/jetbrains-toolbox.desktop
# Install dependency components
RUN apt-get install -y \
iproute2 \
iputils-ping \
netcat-openbsd \
nmap \
socat \
vim
# Clean up
RUN apt-get -y autoclean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/* \
/var/tmp/* \
/tmp/*
# Set up filebrower and sound service
COPY $CONFIG_DIR_SRC/kclient.sh /etc/init.d/kclient
RUN chmod 755 /etc/init.d/kclient
# Create docker init script
COPY $CONFIG_DIR_SRC/entrypoint.sh /.dockerinit
RUN chmod 755 /.dockerinit
USER $USER
WORKDIR "/home/$USER"
VOLUME "/home/$USER"
CMD "/bin/bash"
ENTRYPOINT ["/.dockerinit"]