chore: slim the worker image and streamline the Docker builds

This commit is contained in:
DiheChen committed 2026-11-06 00:47:47 +08:00
1 parent 22ddb5f49c
commit 48dcb1fd97
6 files changed
+102 -42

No files matched your search

+15 -7
View File
@@ -5,16 +5,24 @@ COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ .
RUN npm run build \
&& find dist -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' -o -name '*.svg' -o -name '*.json' -o -name '*.webmanifest' \) -exec gzip -9 -k {} + \
&& sed "s|@VERSION@|${VERSION}|" nginx/default.conf > /tmp/default.conf
&& find dist -type f ! -name '*.png' -exec gzip -9 -k {} + \
&& install -d -m 775 /out/etc/nginx /out/etc/nginx/conf.d \
&& mkdir -p /out/usr/share/nginx \
&& sed "s|@VERSION@|${VERSION}|" nginx/default.conf > /out/etc/nginx/conf.d/default.conf \
&& cp nginx/nginx.conf /out/etc/nginx/nginx.conf \
&& cp -R nginx/templates /out/etc/nginx/alisten-templates \
&& mv dist /out/usr/share/nginx/html
COPY LICENSE /out/usr/share/doc/alisten/
FROM nginxinc/nginx-unprivileged:1.30-alpine
ENV NGINX_ENTRYPOINT_QUIET_LOGS=1
COPY web/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /tmp/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/dist /usr/share/nginx/html
COPY web/nginx/templates /etc/nginx/alisten-templates
COPY LICENSE /usr/share/doc/alisten/
COPY --from=build --parents \
/out/./etc/nginx/nginx.conf \
/out/./etc/nginx/conf.d/default.conf \
/out/./etc/nginx/alisten-templates \
/out/./usr/share/nginx/html \
/out/./usr/share/doc/alisten/LICENSE \
/
EXPOSE 8080 9090
HEALTHCHECK --start-period=30s --start-interval=1s --interval=10s --timeout=3s --retries=3 \
CMD wget -q -O /dev/null http://127.0.0.1:9090/healthz || exit 1