-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
384 lines (362 loc) · 9.49 KB
/
Dockerfile
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# syntax=docker/dockerfile:1
FROM node:12-buster as wwwstage
ARG KASMWEB_RELEASE="2b7e3321ae81cff99510738c2ecee1bcd2853d9b"
RUN \
echo "**** build clientside ****" && \
export QT_QPA_PLATFORM=offscreen && \
export QT_QPA_FONTDIR=/usr/share/fonts && \
mkdir /src && \
cd /src && \
wget https://github.com/kasmtech/noVNC/tarball/${KASMWEB_RELEASE} -O - \
| tar --strip-components=1 -xz && \
npm install && \
npm run-script build
RUN \
echo "**** organize output ****" && \
mkdir /build-out && \
cd /src && \
rm -rf node_modules/ && \
cp -R ./* /build-out/ && \
cd /build-out && \
rm *.md && \
rm AUTHORS && \
cp index.html vnc.html && \
mkdir Downloads
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as buildstage
ARG KASMVNC_RELEASE="v1.2.0"
COPY --from=wwwstage /build-out /www
RUN \
echo "**** install build deps ****" && \
apk add \
alpine-release \
alpine-sdk \
autoconf \
automake \
bash \
ca-certificates \
cmake \
coreutils \
curl \
eudev-dev \
font-cursor-misc \
font-misc-misc \
font-util-dev \
git \
grep \
jq \
libdrm-dev \
libepoxy-dev \
libjpeg-turbo-dev \
libjpeg-turbo-static \
libpciaccess-dev \
libtool \
libwebp-dev \
libx11-dev \
libxau-dev \
libxcb-dev \
libxcursor-dev \
libxcvt-dev \
libxdmcp-dev \
libxext-dev \
libxfont2-dev \
libxkbfile-dev \
libxrandr-dev \
libxshmfence-dev \
libxtst-dev \
mesa-dev \
mesa-dri-gallium \
meson \
nettle-dev \
openssl-dev \
pixman-dev \
procps \
shadow \
tar \
tzdata \
wayland-dev \
wayland-protocols \
xcb-util-dev \
xcb-util-image-dev \
xcb-util-keysyms-dev \
xcb-util-renderutil-dev \
xcb-util-wm-dev \
xinit \
xkbcomp \
xkbcomp-dev \
xkeyboard-config \
xorgproto \
xorg-server-common \
xorg-server-dev \
xtrans
RUN \
echo "**** build libjpeg-turbo ****" && \
mkdir /jpeg-turbo && \
JPEG_TURBO_RELEASE=$(curl -sX GET "https://api.github.com/repos/libjpeg-turbo/libjpeg-turbo/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
curl -o \
/tmp/jpeg-turbo.tar.gz -L \
"https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_TURBO_RELEASE}.tar.gz" && \
tar xf \
/tmp/jpeg-turbo.tar.gz -C \
/jpeg-turbo/ --strip-components=1 && \
cd /jpeg-turbo && \
MAKEFLAGS=-j`nproc` \
CFLAGS="-fpic" \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" && \
make && \
make install
RUN \
echo "**** build kasmvnc ****" && \
git clone https://github.com/kasmtech/KasmVNC.git src && \
cd /src && \
git checkout -f ${KASMVNC_release} && \
sed -i \
-e '/find_package(FLTK/s@^@#@' \
-e '/add_subdirectory(tests/s@^@#@' \
CMakeLists.txt && \
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_VIEWER:BOOL=OFF \
-DENABLE_GNUTLS:BOOL=OFF \
. && \
make -j4 && \
echo "**** build xorg ****" && \
XORG_VER="1.20.14" && \
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') && \
wget --no-check-certificate \
-O /tmp/xorg-server-${XORG_VER}.tar.gz \
"https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz" && \
tar --strip-components=1 \
-C unix/xserver \
-xf /tmp/xorg-server-${XORG_VER}.tar.gz && \
cd unix/xserver && \
patch -Np1 -i ../xserver${XORG_PATCH}.patch && \
patch -s -p0 < ../CVE-2022-2320-v1.20.patch && \
autoreconf -i && \
./configure \
--disable-config-hal \
--disable-config-udev \
--disable-dmx \
--disable-dri \
--disable-dri2 \
--disable-kdrive \
--disable-static \
--disable-xephyr \
--disable-xinerama \
--disable-xnest \
--disable-xorg \
--disable-xvfb \
--disable-xwayland \
--disable-xwin \
--enable-dri3 \
--enable-glx \
--prefix=/opt/kasmweb \
--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \
--without-dtrace \
--with-sha1=libcrypto \
--with-xkb-bin-directory=/usr/bin \
--with-xkb-output=/var/lib/xkb \
--with-xkb-path=/usr/share/X11/xkb && \
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; && \
make -j4
RUN \
echo "**** generate final output ****" && \
cd /src && \
mkdir -p xorg.build/bin && \
cd xorg.build/bin/ && \
ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc && \
cd .. && \
mkdir -p man/man1 && \
touch man/man1/Xserver.1 && \
cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1 && \
mkdir lib && \
cd lib && \
ln -s /usr/lib/xorg/modules/dri dri && \
cd /src && \
mkdir -p builder/www && \
cp -ax /www/* builder/www/ && \
make servertarball && \
mkdir /build-out && \
tar xzf \
kasmvnc-Linux*.tar.gz \
-C /build-out/
# nodejs builder
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as nodebuilder
ARG KCLIENT_RELEASE
RUN \
echo "**** install build deps ****" && \
apk add --no-cache \
alpine-sdk \
curl \
cmake \
g++ \
gcc \
make \
nodejs \
npm \
pulseaudio-dev \
python3
RUN \
echo "**** grab source ****" && \
mkdir -p /kclient && \
if [ -z ${KCLIENT_RELEASE+x} ]; then \
KCLIENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/kclient/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/tmp/kclient.tar.gz -L \
"https://github.com/linuxserver/kclient/archive/${KCLIENT_RELEASE}.tar.gz" && \
tar xf \
/tmp/kclient.tar.gz -C \
/kclient/ --strip-components=1
RUN \
echo "**** install node modules ****" && \
cd /kclient && \
npm install && \
rm -f package-lock.json
# runtime stage
FROM ghcr.io/linuxserver/baseimage-alpine:3.18
# set version label
ARG BUILD_DATE
ARG VERSION
ARG KASMBINS_RELEASE="1.14.0"
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thelamer"
LABEL "com.kasmweb.image"="true"
# env
ENV DISPLAY=:1 \
PERL5LIB=/usr/local/bin \
OMP_WAIT_POLICY=PASSIVE \
GOMP_SPINCOUNT=0 \
HOME=/config \
START_DOCKER=true \
PULSE_RUNTIME_PATH=/defaults \
NVIDIA_DRIVER_CAPABILITIES=all
# copy over build output
COPY --from=nodebuilder /kclient /kclient
COPY --from=buildstage /build-out/ /
RUN \
echo "**** install deps ****" && \
apk add --no-cache \
bash \
ca-certificates \
cups \
cups-client \
dbus-x11 \
docker \
docker-cli-compose \
ffmpeg \
font-noto \
fuse-overlayfs \
gcompat \
intel-media-driver \
libgcc \
libgomp \
libjpeg-turbo \
libstdc++ \
libwebp \
libxfont2 \
libxshmfence \
mcookie \
mesa \
mesa-dri-gallium \
mesa-gbm \
mesa-gl \
mesa-va-gallium \
mesa-vulkan-ati \
mesa-vulkan-intel \
nginx \
nodejs \
openbox \
openssh-client \
openssl \
pciutils-libs \
perl \
perl-datetime \
perl-hash-merge-simple \
perl-list-moreutils \
perl-switch \
perl-try-tiny \
perl-yaml-tiny \
pixman \
alsa-utils \
alsa-tools \
alsaconf \
alsa-plugins-pulse \
vim \
nano \
pulseaudio \
pulseaudio-alsa \
pulseaudio-utils \
py3-xdg \
python3 \
setxkbmap \
sudo \
tar \
xauth \
xf86-video-amdgpu \
xf86-video-ati \
xf86-video-intel \
xf86-video-nouveau \
xf86-video-qxl \
xkbcomp \
xkeyboard-config \
xterm && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
cups-pdf && \
echo "**** printer config ****" && \
sed -i \
"s:^#Out.*:Out /home/kasm-user/PDF:" \
/etc/cups/cups-pdf.conf && \
sed -i \
's/^SystemGroup .*/SystemGroup lpadmin root/' \
/etc/cups/cups-files.conf && \
echo "**** filesystem setup ****" && \
ln -s /usr/local/share/kasmvnc /usr/share/kasmvnc && \
ln -s /usr/local/etc/kasmvnc /etc/kasmvnc && \
ln -s /usr/local/lib/kasmvnc /usr/lib/kasmvncserver && \
echo "**** openbox tweaks ****" && \
sed -i \
's/NLIMC/NLMC/g' \
/etc/xdg/openbox/rc.xml && \
echo "**** user perms ****" && \
echo "abc:abc" | chpasswd && \
usermod -s /bin/bash abc && \
echo '%wheel ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/wheel && \
adduser abc wheel && \
echo "**** kasm support ****" && \
useradd \
-u 1000 -U \
-d /home/kasm-user \
-s /bin/bash kasm-user && \
echo "kasm-user:kasm" | chpasswd && \
adduser kasm-user wheel && \
mkdir -p /home/kasm-user && \
chown 1000:1000 /home/kasm-user && \
mkdir -p /var/run/pulse && \
chown 1000:root /var/run/pulse && \
mkdir -p /kasmbins && \
curl -s https://kasm-ci.s3.amazonaws.com/kasmbins-amd64-${KASMBINS_RELEASE}.tar.gz \
| tar xzvf - -C /kasmbins/ && \
chmod +x /kasmbins/* && \
chown -R 1000:1000 /kasmbins && \
chown 1000:1000 /usr/share/kasmvnc/www/Downloads && \
echo "**** dind support ****" && \
addgroup -S dockremap && \
adduser -S -G dockremap dockremap && \
echo 'dockremap:165536:65536' >> /etc/subuid && \
echo 'dockremap:165536:65536' >> /etc/subgid && \
curl -o \
/usr/local/bin/dind -L \
https://raw.githubusercontent.com/moby/moby/master/hack/dind && \
chmod +x /usr/local/bin/dind && \
usermod -aG docker abc && \
echo 'hosts: files dns' > /etc/nsswitch.conf && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files
COPY /root /
# ports and volumes
EXPOSE 3000 3001
VOLUME /config