59 lines
3.1 KiB
Docker
59 lines
3.1 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM node:20-alpine AS builder
|
|
|
|
ARG MUON_GIT_REF=main
|
|
|
|
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 --from=shared stemengine-bootstrap.js /tmp/stemengine-bootstrap.js
|
|
COPY --from=shared stemengine-router.js /tmp/stemengine-router.js
|
|
COPY --from=shared stemengine-audio-engine.js /tmp/stemengine-audio-engine.js
|
|
COPY --from=shared stemengine-feature-extractor.js /tmp/stemengine-feature-extractor.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).
|
|
# D-8 fix: the STEMENGINE_ALLOWED_ORIGIN sed replacement is dropped — isAllowedOrigin()
|
|
# is unconditionally true (project policy: zero access control on this path). The build
|
|
# arg, .env.example entry, and GHA workflow input are also vestigial; remove there too.
|
|
RUN cp /tmp/stemengine-router.js /src/app/src/stemengine-router.js
|
|
|
|
# Inject iframe-local audio engine + feature extractor for transport-driven analysis.
|
|
RUN cp /tmp/stemengine-audio-engine.js /src/app/src/stemengine-audio-engine.js
|
|
RUN cp /tmp/stemengine-feature-extractor.js /src/app/src/stemengine-feature-extractor.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, audio pipeline, router, then render graphs).
|
|
RUN sed -i '1i import "./stemengine-bootstrap";\nimport "./stemengine-audio-engine";\nimport "./stemengine-feature-extractor";\nimport "./stemengine-router";\nimport "./spirit-render-graph";' /src/app/src/index.js
|
|
|
|
# Default-mode integration: allow original Muon analyser reads to use StemEngine analyser.
|
|
RUN sed -i 's@analyser = wavesurfer.backend.analyser@analyser = (window.__STEMENGINE_MUON_ANALYSER__ || wavesurfer.backend.analyser)@' /src/app/src/index.js
|
|
|
|
# Register default Muon STOP/RESUME hooks so custom render graphs can pause/resume
|
|
# the original RAF loop and avoid dual-renderer canvas conflicts.
|
|
#
|
|
# D-7 follow-up: register STOP/RESUME at module scope without touching animate
|
|
# initialization order. Referencing animate before declaration can trigger a TDZ
|
|
# runtime crash in production bundles. Resume calls animate lazily via closure.
|
|
RUN sed -i 's@let wavesurfer,@window.__STEMENGINE_MUON_STOP_FN__ = () => { pauseAnimation = true }; window.__STEMENGINE_MUON_RESUME_FN__ = () => { if (!pauseAnimation) return; const pauseButton = document.getElementById("control-animation"); if (pauseButton \&\& typeof pauseButton.click === "function") { pauseButton.click(); return; } pauseAnimation = false; }; let wavesurfer,@' /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
|