# Multi-stage Dockerfile for MelodyMuse. # # This file lives in the MelodyMuse repo under `deploy/` as a reference. To # add MelodyMuse to a Docker-Compose deployment (including your Jannik-Cloud # stack), copy this file to your service directory and reference it from # docker-compose.yml — see `docker-compose.example.yml`. # Stage 1 — build the SPA FROM node:20-alpine AS builder RUN apk add --no-cache git # Override these at build time if you fork the repo. ARG REPO_URL=https://git.orfel.de/Jannik/MelodyMuse.git ARG BRANCH=main WORKDIR /build RUN git clone --depth 1 --branch ${BRANCH} ${REPO_URL} . RUN npm ci RUN npm run build # Stage 2 — runtime: just Node + the built assets + the proxy server FROM node:20-alpine WORKDIR /app COPY --from=builder /build/dist ./dist COPY --from=builder /build/server.mjs ./server.mjs COPY --from=builder /build/server ./server COPY --from=builder /build/package.json ./package.json # server.mjs uses only Node's built-ins — no production deps to install. # Install nothing here; the image stays small. ENV NODE_ENV=production ENV PORT=3000 EXPOSE 3000 # Quick healthcheck so Docker / your orchestrator can detect a broken boot. HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ CMD wget -qO- http://localhost:3000/api/health || exit 1 CMD ["node", "server.mjs"]