From edeeec3c41f2f4c02f6a5641f7ae9ced06090733 Mon Sep 17 00:00:00 2001 From: Huarch Date: Thu, 22 Oct 2026 13:05:04 +0800 Subject: [PATCH] chore(docker): pin patched Node runtime --- Dockerfile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 04238e5..f0c26c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM node:24-alpine@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43 AS build +ARG NODE_IMAGE=node:24.22.1-alpine@sha256:06d7adf3e0ef61a13f1d28682726366f97a15aa1888c934d3ecec86c33918b53 + +FROM ${NODE_IMAGE} AS build ARG NPM_REGISTRY=https://registry.npmmirror.com ENV COREPACK_NPM_REGISTRY=${NPM_REGISTRY} @@ -13,17 +15,26 @@ RUN pnpm install --frozen-lockfile --registry="${NPM_REGISTRY}" COPY . . RUN pnpm build -FROM caddy:2.10.2-alpine@sha256:4c6e91c6ed0e2fa03efd5b44747b625fec79bc9cd06ac5235a779726618e530d +FROM caddy:2.10.2-alpine@sha256:4c6e91c6ed0e2fa03efd5b44747b625fec79bc9cd06ac5235a779726618e530d AS caddy-bin + +FROM ${NODE_IMAGE} AS runner ARG ALPINE_MIRROR=mirrors.aliyun.com RUN sed -i "s|dl-cdn.alpinelinux.org|${ALPINE_MIRROR}|g" /etc/apk/repositories && \ - apk add --no-cache jq nodejs + apk add --no-cache ca-certificates jq mailcap && \ + mkdir -p /config/caddy /data/caddy /etc/caddy /srv && \ + chmod 1777 /config/caddy /data/caddy +ENV XDG_CONFIG_HOME=/config +ENV XDG_DATA_HOME=/data +COPY --from=caddy-bin /usr/bin/caddy /usr/bin/caddy COPY Caddyfile /etc/caddy/Caddyfile COPY docker-entrypoint.sh /usr/local/bin/tjwater-frontend-entrypoint COPY --from=build /app/dist /srv COPY --from=build /app/dist-server/edge-tts-server.cjs /usr/local/lib/tjwater-frontend/edge-tts-server.cjs RUN chmod 755 /usr/local/bin/tjwater-frontend-entrypoint +WORKDIR /srv + EXPOSE 80 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD wget --quiet --spider http://127.0.0.1/ || exit 1