-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
126 lines (97 loc) · 3.68 KB
/
Dockerfile
File metadata and controls
126 lines (97 loc) · 3.68 KB
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
FROM node:24-alpine AS client-builder
WORKDIR /app
RUN apk upgrade --no-cache
# Yarn 1.x uses url.parse(); Node 24+ deprecates it (DEP0169). Silence only in build stage.
ENV NODE_OPTIONS=--disable-warning=DEP0169
ENV YARN_CACHE_FOLDER=/tmp/yarn-cache
COPY vendor/guacamole-client/guacamole-common-js/ ./vendor/guacamole-client/guacamole-common-js/
WORKDIR /app/client
COPY client/package.json client/yarn.lock ./
RUN install_ok=0; \
for i in 1 2 3; do \
yarn install --frozen-lockfile --network-timeout 500000 && install_ok=1 && break; \
yarn cache clean --all || true; \
rm -rf "${YARN_CACHE_FOLDER}" || true; \
sleep 15; \
done; \
[ "${install_ok}" -eq 1 ]; \
yarn cache clean --all || true; \
rm -rf "${YARN_CACHE_FOLDER}" || true
COPY client/ .
RUN yarn build
FROM node:24-alpine AS server-builder
ARG VERSION
WORKDIR /app
RUN apk upgrade --no-cache
ENV NODE_OPTIONS=--disable-warning=DEP0169
ENV YARN_CACHE_FOLDER=/tmp/yarn-cache
RUN apk add --no-cache \
python3 py3-pip py3-setuptools \
make g++ gcc build-base \
jq
COPY package.json yarn.lock ./
RUN if [ -n "$VERSION" ]; then \
jq --arg v "$VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json; \
fi
RUN install_ok=0; \
for i in 1 2 3; do \
yarn install --production --frozen-lockfile --network-timeout 500000 && install_ok=1 && break; \
yarn cache clean --all || true; \
rm -rf "${YARN_CACHE_FOLDER}" || true; \
sleep 15; \
done; \
[ "${install_ok}" -eq 1 ]; \
yarn cache clean --all || true; \
rm -rf "${YARN_CACHE_FOLDER}" || true
COPY server/ server/
FROM node:24-alpine AS guacd-builder
RUN apk upgrade --no-cache
RUN apk add --no-cache \
cairo-dev jpeg-dev libpng-dev ossp-uuid-dev \
pango-dev libvncserver-dev libwebp-dev openssl-dev freerdp2-dev \
pulseaudio-dev libvorbis-dev libogg-dev libssh2-dev \
ffmpeg-dev \
build-base autoconf automake libtool
WORKDIR /build
COPY vendor/guacamole-server/ ./guacamole-server/
RUN cd guacamole-server \
&& autoreconf -fi \
&& ./configure --with-init-dir=/etc/init.d --prefix=/usr/local --disable-guacenc --disable-guaclog \
&& make -j$(nproc) \
&& make DESTDIR=/install install \
&& rm -rf /install/usr/local/include \
&& rm -f /install/usr/local/lib/*.a \
&& rm -f /install/usr/local/lib/*.la \
&& rm -f /install/usr/local/*.md /install/usr/local/LICENSE \
&& strip /install/usr/local/sbin/guacd /install/usr/local/lib/*.so.* 2>/dev/null || true
FROM node:24-alpine
RUN apk upgrade --no-cache
RUN apk add --no-cache \
cairo jpeg libpng ossp-uuid \
pango libvncserver libwebp openssl freerdp2-libs \
pulseaudio libvorbis libogg libssh2 \
ffmpeg-libavcodec ffmpeg-libavformat ffmpeg-libavutil ffmpeg-libswscale \
util-linux samba-client
RUN rm -rf /usr/local/lib/node_modules/npm \
/usr/local/lib/node_modules/corepack \
/usr/local/bin/npm \
/usr/local/bin/npx \
/usr/local/bin/corepack \
/usr/local/bin/yarn \
/usr/local/bin/yarnpkg
COPY --from=guacd-builder /install/usr/local/sbin/ /usr/local/sbin/
COPY --from=guacd-builder /install/usr/local/lib/ /usr/local/lib/
COPY --from=guacd-builder /install/usr/lib/freerdp2/ /usr/lib/freerdp2/
RUN ldconfig /usr/local/lib 2>/dev/null || true
ENV NODE_ENV=production
ENV LOG_LEVEL=system
WORKDIR /app
COPY --from=client-builder /app/client/dist ./dist
COPY --from=server-builder /app/server ./server
COPY --from=server-builder /app/node_modules ./node_modules
COPY --from=server-builder /app/package.json ./
COPY --from=server-builder /app/yarn.lock ./
COPY docker-start.sh .
RUN chmod +x docker-start.sh
EXPOSE 6989
CMD ["/bin/sh", "docker-start.sh"]