Files
stemengine_old/muon-iframe/Dockerfile
T
2026-04-21 16:24:11 +09:00

52 lines
2.1 KiB
Docker

FROM node:20-alpine AS builder
ARG MUON_GIT_REF=main
# Origin that the Muon iframe will accept postMessage commands from and emit
# ready/error events back to. Must match the StemEngine frontend origin.
# Examples: http://localhost:5173 (dev), https://stemengine.example.com (prod)
ARG STEMENGINE_ALLOWED_ORIGIN=http://localhost:5173
WORKDIR /src
RUN apk add --no-cache git \
&& git clone --depth 1 --branch "${MUON_GIT_REF}" https://github.com/najafmohammed/muon-music-visualizer.git app
COPY overlayless.css /tmp/overlayless.css
COPY stemengine-bootstrap.js /tmp/stemengine-bootstrap.js
COPY stemengine-router.js /tmp/stemengine-router.js
COPY fluid-render-graph.js /tmp/fluid-render-graph.js
COPY tendrils-render-graph.js /tmp/tendrils-render-graph.js
COPY spirit-render-graph.js /tmp/spirit-render-graph.js
WORKDIR /src/app
RUN cat /tmp/overlayless.css >> /src/app/src/style.css
# Inject bootstrap (WebGL baseline checks + context lifecycle hooks)
RUN cp /tmp/stemengine-bootstrap.js /src/app/src/stemengine-bootstrap.js
# Inject router (style router + postMessage command listener + ready/error emitter)
# Replace the placeholder origin token with the build-arg value.
RUN cp /tmp/stemengine-router.js /src/app/src/stemengine-router.js \
&& sed -i "s|__STEMENGINE_ALLOWED_ORIGIN__|${STEMENGINE_ALLOWED_ORIGIN}|g" /src/app/src/stemengine-router.js
# Inject fluid render graph (Phase 2: Fluid rendering)
RUN cp /tmp/fluid-render-graph.js /src/app/src/fluid-render-graph.js
# Inject tendrils render graph (Phase 3)
RUN cp /tmp/tendrils-render-graph.js /src/app/src/tendrils-render-graph.js
# Inject spirit render graph (Phase 4)
RUN cp /tmp/spirit-render-graph.js /src/app/src/spirit-render-graph.js
# Inject imports in deterministic order (bootstrap first, then router, then render graphs).
RUN sed -i '1i import "./stemengine-bootstrap";\nimport "./stemengine-router";\nimport "./fluid-render-graph";\nimport "./tendrils-render-graph";\nimport "./spirit-render-graph";' /src/app/src/index.js
RUN npm install
RUN npm run build
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /src/app/dist /usr/share/nginx/html
EXPOSE 80