Files
mermaid-live-editor/Dockerfile
T
Sidharth VinodandClaude Opus 5.5 5eedbbecfa ci: Build the Docker image's static site natively instead of under QEMU
The multi-platform Docker build ran pnpm install and pnpm build for
linux/arm64 under QEMU emulation. QEMU intermittently crashes there
("qemu: uncaught target signal 4 (Illegal instruction)") or stalls, and
buildkit then waits until GitHub cancels the job at 6 hours: 16
cancelled runs in September, including a develop push.

The build output is a static site, identical on every architecture, so
the node stages now run on $BUILDPLATFORM and only the nginx stage
(COPY only) is built per architecture. Also caps the job at 30 minutes
so any future hang fails fast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 10:51:35 +05:30

43 lines
1.0 KiB
Docker

# The build output is a static site, so build it once on the runner's native
# platform instead of under QEMU emulation; only the nginx stage below is
# per-architecture.
FROM --platform=$BUILDPLATFORM docker.io/library/node:24.16.0-alpine3.22 AS mermaid-live-editor-dependencies
RUN apk --no-cache add build-base git python3 && \
rm -rf /var/cache/apk/*
RUN corepack enable pnpm
WORKDIR /app
COPY ./package.json .
COPY ./pnpm-lock.yaml .
RUN pnpm install
FROM mermaid-live-editor-dependencies AS mermaid-live-editor-builder
ARG MERMAID_RENDERER_URL
ARG MERMAID_KROKI_RENDERER_URL
ARG MERMAID_ANALYTICS_URL
ARG MERMAID_DOMAIN
ARG MERMAID_IS_ENABLED_MERMAID_CHART_LINKS
ARG MERMAID_PRIVACY_POLICY_URL
ARG MERMAID_HIDE_PRIVACY_POLICY
ARG MERMAID_BASE_PATH
COPY . ./
RUN pnpm build
FROM mermaid-live-editor-builder AS mermaid-dev
ENTRYPOINT ["pnpm", "dev"]
FROM nginx:1.28-alpine3.21 AS mermaid
EXPOSE 8080
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=mermaid-live-editor-builder /app/docs /usr/share/nginx/html