forked from jlesage/docker-baseimage-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
281 lines (257 loc) · 10.1 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
# syntax=docker/dockerfile:1.4
#
# baseimage-gui Dockerfile
#
# https://github.com/jlesage/docker-baseimage-gui
#
# ARG BASEIMAGE=unknown
# ARG BASEIMAGE=alpine:3.15
# Define the Alpine packages to be installed into the image.
# ARG ALPINE_PKGS="\
# # Needed to generate self-signed certificates
# openssl \
# # Needed to use netcat with unix socket.
# netcat-openbsd \
# "
# Define the Debian/Ubuntu packages to be installed into the image.
# ARG DEBIAN_PKGS="\
# # Used to determine if nginx is ready.
# netcat \
# # For ifconfig
# net-tools \
# # Needed to generate self-signed certificates
# openssl \
# "
# Build TigerVNC server.
# FROM infrastlabs/x11-base:builder AS cache1
# # build.sh: split multi steps, to speed up
# COPY src/tigervnc/build.sh /build/build.sh
# RUN sh /build/build.sh cache
# --platform=$BUILDPLATFORM
FROM infrastlabs/x11-base:builder AS tigervnc
ARG TARGETPLATFORM
# COPY --from=xx / /
# COPY --from=upx /usr/bin/upx /usr/bin/upx
RUN apk update; apk add gawk;
ENV TARGETPATH=/usr
# COPY --from=cache1 /mnt /mnt
# https://blog.csdn.net/sodaloveer/article/details/127727729 #batch_exec
COPY src/tigervnc/build.sh /build/build.sh
RUN sh /build/build.sh cache
RUN sh /build/build.sh b_deps
#
COPY src/tigervnc /build
RUN sh /build/build.sh b_tiger
# RUN apk --no-cache add bash; bash -c """sh /build/build.sh gnutls & ; \
# sh /build/build.sh libxfont2 & ; \
# sh /build/build.sh libfontenc & ; \
# sh /build/build.sh libtasn1 & ; \
# sh /build/build.sh libxshmfence & ; \
# wait ; \
# sh /build/build.sh tigervnc & ; \
# sh /build/build.sh xkb & ; \
# sh /build/build.sh xkbcomp & ; \
# wait ;"""
#
RUN xx-verify --static /tmp/tigervnc-install/usr/bin/Xvnc; \
xx-verify --static /tmp/tigervnc-install/usr/bin/vncpasswd
RUN upx /tmp/tigervnc-install/usr/bin/Xvnc; \
upx /tmp/tigervnc-install/usr/bin/vncpasswd
# Build xdpyprobe.
# Used to determine if the X server (Xvnc) is ready.
# FROM infrastlabs/x11-base:builder AS xdpyprobe
# ARG TARGETPLATFORM
# COPY --from=xx / /
# COPY --from=upx /usr/bin/upx /usr/bin/upx
COPY src/xdpyprobe /tmp/xdpyprobe
# RUN apk --no-cache add make clang
# RUN xx-apk --no-cache add gcc musl-dev libx11-dev libx11-static libxcb-static
#
RUN CC=xx-clang \
make -C /tmp/xdpyprobe
RUN xx-verify --static /tmp/xdpyprobe/xdpyprobe; \
upx /tmp/xdpyprobe/xdpyprobe
# Build Fontconfig.
# FROM infrastlabs/x11-base:builder AS fontconfig
# ARG TARGETPLATFORM
# # COPY --from=xx / /
# COPY src/fontconfig/build.sh /tmp/build-fontconfig.sh
# RUN /tmp/build-fontconfig.sh
# Build Openbox.
# FROM infrastlabs/x11-base:builder AS openbox
# ARG TARGETPLATFORM
# # COPY --from=xx / /
# COPY --from=fontconfig /tmp/fontconfig-install /tmp/fontconfig-install
# COPY src/openbox /tmp/build
# RUN /tmp/build/build.sh
# RUN xx-verify --static \
# /tmp/openbox-install/usr/bin/openbox \
# /tmp/openbox-install/usr/bin/obxprop
# # COPY --from=upx /usr/bin/upx /usr/bin/upx
# RUN upx /tmp/openbox-install/usr/bin/openbox
# RUN upx /tmp/openbox-install/usr/bin/obxprop
# Build yad.
# FROM infrastlabs/x11-base:builder AS yad
# ARG TARGETPLATFORM
# # COPY --from=xx / /
# COPY --from=fontconfig /tmp/fontconfig-install /tmp/fontconfig-install
# COPY src/yad/build.sh /tmp/build-yad.sh
# RUN /tmp/build-yad.sh
# RUN xx-verify --static /tmp/yad-install/usr/bin/yad
# # COPY --from=upx /usr/bin/upx /usr/bin/upx
# RUN upx /tmp/yad-install/usr/bin/yad
# COPY --link --from=tigervnc /tmp/tigervnc-install/usr/bin/Xvnc /rootfs/usr/bin/
# COPY --link --from=tigervnc /tmp/tigervnc-install/usr/bin/vncpasswd /rootfs/usr/bin/
# COPY --link --from=tigervnc /tmp/xkb-install/usr/share/X11/xkb /rootfs/usr/share/X11/xkb
# COPY --link --from=tigervnc /tmp/xkbcomp-install/usr/bin/xkbcomp /rootfs/usr/bin/
# COPY --link --from=xdpyprobe /tmp/xdpyprobe/xdpyprobe /rootfs/usr/bin/
RUN rm -rf /rootfs; mkdir -p /rootfs${TARGETPATH}/bin /rootfs${TARGETPATH}/share/X11; \
\cp -a /tmp/tigervnc-install/usr/bin/Xvnc /rootfs${TARGETPATH}/bin/; \
\cp -a /tmp/tigervnc-install/usr/bin/vncpasswd /rootfs${TARGETPATH}/bin/; \
\cp -a /tmp/xkb-install/usr/share/X11/xkb /rootfs${TARGETPATH}/share/X11/xkb; \
\cp -a /tmp/xkbcomp-install/usr/bin/xkbcomp /rootfs${TARGETPATH}/bin/; \
\cp -a /tmp/xdpyprobe/xdpyprobe /rootfs${TARGETPATH}/bin/; \
\cp -a /tmp/logs /rootfs/
# validate
RUN du -sh /rootfs; \
/rootfs/usr/bin/Xvnc -version; \
find /rootfs -type f |sort
# Build Nginx.
# FROM infrastlabs/x11-base:builder AS nginx
# ARG TARGETPLATFORM
# # COPY --from=xx / /
# COPY src/nginx/build.sh /tmp/build-nginx.sh
# RUN /tmp/build-nginx.sh
# RUN xx-verify --static /tmp/nginx-install/sbin/nginx
# # COPY --from=upx /usr/bin/upx /usr/bin/upx
# RUN upx /tmp/nginx-install/sbin/nginx
# # NOTE: Extended attributes are kept by buildx when using the COPY command.
# # See https://wildwolf.name/multi-stage-docker-builds-and-xattrs/.
# RUN apk --no-cache add libcap && setcap cap_net_bind_service=ep /tmp/nginx-install/sbin/nginx
# Build noVNC.
# FROM infrastlabs/x11-base:builder AS noVNC
# ARG NOVNC_VERSION=1.4.0
# ARG BOOTSTRAP_VERSION=5.1.3
# ARG BOOTSTRAP_NIGHTSHADE_VERSION=1.1.3
# ARG FONTAWESOME_VERSION=4.7.0
# ARG NOVNC_URL=https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.tar.gz
# ARG BOOTSTRAP_URL=https://github.com/twbs/bootstrap/releases/download/v${BOOTSTRAP_VERSION}/bootstrap-${BOOTSTRAP_VERSION}-dist.zip
# ARG BOOTSTRAP_NIGHTSHADE_URL=https://github.com/vinorodrigues/bootstrap-dark-5/archive/refs/tags/v${BOOTSTRAP_NIGHTSHADE_VERSION}.tar.gz
# ARG FONTAWESOME_URL=https://fontawesome.com/v${FONTAWESOME_VERSION}/assets/font-awesome-${FONTAWESOME_VERSION}.zip
# WORKDIR /tmp
# COPY helpers/* /usr/bin/
# COPY rootfs/opt/noVNC/index.html /opt/noVNC/index.html
# RUN \
# # Install required tools.
# apk --no-cache add \
# curl \
# sed \
# jq \
# npm \
# && \
# npm install clean-css-cli -g
# RUN \
# # Create required directories.
# mkdir -p \
# /opt/noVNC/app/styles \
# /opt/noVNC/app/fonts
# RUN \
# # Install noVNC.
# mkdir /tmp/noVNC && \
# curl -# -L ${NOVNC_URL} | tar -xz --strip 1 -C /tmp/noVNC && \
# cp -vr /tmp/noVNC/core /opt/noVNC/ && \
# cp -vr /tmp/noVNC/vendor /opt/noVNC/
# RUN \
# # Install Bootstrap.
# # NOTE: Only copy the JS bundle, since the CSS is taken from Bootstrap
# # Nightshade.
# curl -sS -L -O ${BOOTSTRAP_URL} && \
# unzip bootstrap-${BOOTSTRAP_VERSION}-dist.zip && \
# #cp -v bootstrap-${BOOTSTRAP_VERSION}-dist/css/bootstrap.min.css /opt/noVNC/app/styles/ && \
# cp -v bootstrap-${BOOTSTRAP_VERSION}-dist/js/bootstrap.bundle.min.js* /opt/noVNC/app/
# RUN \
# # Install Bootstrap Nightshade.
# mkdir /tmp/bootstrap-nightshade && \
# curl -# -L ${BOOTSTRAP_NIGHTSHADE_URL} | tar -xz --strip 1 -C /tmp/bootstrap-nightshade && \
# cleancss \
# -O1 \
# --format breakWith=lf \
# --output /opt/noVNC/app/styles/bootstrap-nightshade.min.css \
# /tmp/bootstrap-nightshade/dist/css/bootstrap-nightshade.css
# RUN \
# # Install Font Awesome.
# curl -sS -L -O ${FONTAWESOME_URL} && \
# unzip font-awesome-${FONTAWESOME_VERSION}.zip && \
# cp -v font-awesome-${FONTAWESOME_VERSION}/fonts/fontawesome-webfont.* /opt/noVNC/app/fonts/ && \
# cp -v font-awesome-${FONTAWESOME_VERSION}/css/font-awesome.min.css /opt/noVNC/app/styles/
# RUN \
# # Set version of CSS and JavaScript file URLs.
# sed "s/UNIQUE_VERSION/$(date | md5sum | cut -c1-10)/g" -i /opt/noVNC/index.html
# RUN \
# # Generate favicons.
# APP_ICON_URL=https://github.com/jlesage/docker-templates/raw/master/jlesage/images/generic-app-icon.png && \
# install_app_icon.sh --no-tools-install "$APP_ICON_URL"
# Generate default DH params.
# FROM infrastlabs/x11-base:builder AS dhparam
# RUN apk --no-cache add openssl
# RUN echo "Generating default DH parameters (2048 bits)..."
# RUN openssl dhparam \
# -out "/tmp/dhparam.pem" \
# 2048 \
# > /dev/null 2>&1
# Pull base image.
# FROM ${BASEIMAGE}
# Define working directory.
# WORKDIR /tmp
# Install system packages.
# ARG ALPINE_PKGS
# ARG DEBIAN_PKGS
# RUN \
# if [ -n "$(which apk)" ]; then \
# add-pkg ${ALPINE_PKGS}; \
# else \
# add-pkg ${DEBIAN_PKGS}; \
# fi && \
# # Remove some unneeded stuff.
# rm -rf /var/cache/fontconfig/*
# Add files.
# # COPY --link helpers/* /rootfs/usr/bin/
# # COPY --link rootfs/ /
# COPY --link --from=tigervnc /tmp/tigervnc-install/usr/bin/Xvnc /rootfs/usr/bin/
# COPY --link --from=tigervnc /tmp/tigervnc-install/usr/bin/vncpasswd /rootfs/usr/bin/
# COPY --link --from=tigervnc /tmp/xkb-install/usr/share/X11/xkb /rootfs/usr/share/X11/xkb
# COPY --link --from=tigervnc /tmp/xkbcomp-install/usr/bin/xkbcomp /rootfs/usr/bin/
# COPY --link --from=xdpyprobe /tmp/xdpyprobe/xdpyprobe /rootfs/usr/bin/
#
# COPY --link --from=fontconfig /tmp/fontconfig-install/opt /opt
# COPY --link --from=openbox /tmp/openbox-install/usr/bin/openbox /rootfs/usr/bin/
# COPY --link --from=openbox /tmp/openbox-install/usr/bin/obxprop /rootfs/usr/bin/
# COPY --link --from=yad /tmp/yad-install/usr/bin/yad /rootfs/usr/bin/
#
# COPY --link --from=nginx /tmp/nginx-install /rootfs/usr/
# COPY --link --from=dhparam /tmp/dhparam.pem /defaults/
# COPY --link --from=noVNC /opt/noVNC /opt/noVNC
# Set environment variables.
# ENV \
# DISPLAY_WIDTH=1920 \
# DISPLAY_HEIGHT=1080 \
# DARK_MODE=0 \
# SECURE_CONNECTION=0 \
# SECURE_CONNECTION_VNC_METHOD=SSL \
# SECURE_CONNECTION_CERTS_CHECK_INTERVAL=60 \
# WEB_LISTENING_PORT=5800 \
# VNC_LISTENING_PORT=5900 \
# VNC_PASSWORD= \
# ENABLE_CJK_FONT=0
# Expose ports.
# - 5800: VNC web interface
# - 5900: VNC
# EXPOSE 5800 5900
# Metadata.
# ARG IMAGE_VERSION=unknown
# LABEL \
# org.label-schema.name="baseimage-gui" \
# org.label-schema.description="A minimal docker baseimage to ease creation of X graphical application containers" \
# org.label-schema.version="${IMAGE_VERSION}" \
# org.label-schema.vcs-url="https://github.com/jlesage/docker-baseimage-gui" \
# org.label-schema.schema-version="1.0"