mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
All deployment commands now go through deployment.py. Deleted: build-base-images.sh, build-apps.sh, build-testcontainers.sh, deploy.sh, start-stack.sh, release.sh, nexus-ci-init.sh, push-to-nexus.sh, populate-nexus.sh, publish-npm-patches.sh. Kept nexus-init.sh and artifactory-init.sh (Docker container entrypoints). Updated all references in CLAUDE.md, README.md, AGENTS.md, ROADMAP.md, deployment docs, Dockerfiles, and docker-compose comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
172 lines
9.2 KiB
Docker
172 lines
9.2 KiB
Docker
# metabuilder/base-node-deps
|
|
#
|
|
# Node 24 + all 33 workspace npm packages pre-installed.
|
|
# App Dockerfiles copy node_modules from this image instead of running npm ci.
|
|
#
|
|
# Build: docker build -f Dockerfile.node-deps -t metabuilder/base-node-deps:latest ../../
|
|
# App Dockerfiles:
|
|
# COPY --from=metabuilder/base-node-deps /app/node_modules ./node_modules
|
|
|
|
FROM node:24
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy ONLY package manifests — source changes won't bust this cache layer.
|
|
# Root manifest + registry config (lock file generated by npm install)
|
|
COPY package.json .npmrc ./
|
|
|
|
# All workspace package manifests (alphabetical)
|
|
COPY components/package.json ./components/
|
|
COPY components/fakemui/package.json ./components/fakemui/
|
|
COPY config/package.json ./config/
|
|
COPY scss/package.json ./scss/
|
|
COPY frontends/codegen/package.json ./frontends/codegen/
|
|
COPY frontends/dbal/package.json ./frontends/dbal/
|
|
COPY frontends/emailclient/package.json ./frontends/emailclient/
|
|
COPY frontends/exploded-diagrams/package.json ./frontends/exploded-diagrams/
|
|
COPY frontends/nextjs/package.json ./frontends/nextjs/
|
|
COPY frontends/pastebin/package.json ./frontends/pastebin/
|
|
COPY frontends/postgres/package.json ./frontends/postgres/
|
|
COPY frontends/workflowui/package.json ./frontends/workflowui/
|
|
COPY hooks/package.json ./hooks/
|
|
COPY interfaces/package.json ./interfaces/
|
|
COPY redux/adapters/package.json ./redux/adapters/
|
|
COPY redux/api-clients/package.json ./redux/api-clients/
|
|
COPY redux/core/package.json ./redux/core/
|
|
COPY redux/core-hooks/package.json ./redux/core-hooks/
|
|
COPY redux/hooks/package.json ./redux/hooks/
|
|
COPY redux/hooks-async/package.json ./redux/hooks-async/
|
|
COPY redux/hooks-auth/package.json ./redux/hooks-auth/
|
|
COPY redux/hooks-canvas/package.json ./redux/hooks-canvas/
|
|
COPY redux/hooks-data/package.json ./redux/hooks-data/
|
|
COPY redux/hooks-forms/package.json ./redux/hooks-forms/
|
|
COPY redux/hooks-utils/package.json ./redux/hooks-utils/
|
|
COPY redux/middleware/package.json ./redux/middleware/
|
|
COPY redux/persist/package.json ./redux/persist/
|
|
COPY redux/services/package.json ./redux/services/
|
|
COPY redux/slices/package.json ./redux/slices/
|
|
COPY redux/timing-utils/package.json ./redux/timing-utils/
|
|
COPY storybook/package.json ./storybook/
|
|
COPY translations/package.json ./translations/
|
|
COPY types/package.json ./types/
|
|
COPY workflow/package.json ./workflow/
|
|
|
|
# Postinstall patch script (patches vulnerable bundled deps in npm)
|
|
COPY scripts/patch-bundled-deps.sh ./scripts/
|
|
|
|
# Install all workspace deps (generates lock file from package.json manifests)
|
|
#
|
|
# Pre-flight: auto-detect local registry (Nexus on :8091, Verdaccio on :4873)
|
|
# and rewrite .npmrc scoped registries accordingly. This lets the same .npmrc
|
|
# work in CI (Verdaccio) and on desktops running Nexus.
|
|
RUN npm config set fetch-retries 5 \
|
|
&& npm config set fetch-retry-mintimeout 20000 \
|
|
&& npm config set maxsockets 5 \
|
|
&& echo "==> Detecting local npm registry..." \
|
|
&& NEXUS_NPM="http://host.docker.internal:8091/repository/npm-group/" \
|
|
&& VERDACCIO="http://host.docker.internal:4873/" \
|
|
&& NEXUS_NPM_LOCAL="http://localhost:8091/repository/npm-group/" \
|
|
&& VERDACCIO_LOCAL="http://localhost:4873/" \
|
|
&& LOCAL_REG="" \
|
|
&& LOCAL_REG_AUTH="" \
|
|
&& if wget -q --spider --timeout=3 "$NEXUS_NPM" 2>/dev/null \
|
|
|| curl -sf --connect-timeout 3 "$NEXUS_NPM" >/dev/null 2>&1; then \
|
|
LOCAL_REG="$NEXUS_NPM"; \
|
|
LOCAL_REG_AUTH="//host.docker.internal:8091/repository/npm-hosted/:_auth=YWRtaW46bmV4dXM="; \
|
|
echo " Nexus detected at $NEXUS_NPM"; \
|
|
elif wget -q --spider --timeout=3 "$NEXUS_NPM_LOCAL" 2>/dev/null \
|
|
|| curl -sf --connect-timeout 3 "$NEXUS_NPM_LOCAL" >/dev/null 2>&1; then \
|
|
LOCAL_REG="$NEXUS_NPM_LOCAL"; \
|
|
LOCAL_REG_AUTH="//localhost:8091/repository/npm-hosted/:_auth=YWRtaW46bmV4dXM="; \
|
|
echo " Nexus detected at $NEXUS_NPM_LOCAL"; \
|
|
elif wget -q --spider --timeout=3 "$VERDACCIO" 2>/dev/null \
|
|
|| curl -sf --connect-timeout 3 "$VERDACCIO" >/dev/null 2>&1; then \
|
|
LOCAL_REG="$VERDACCIO"; \
|
|
LOCAL_REG_AUTH="//host.docker.internal:4873/:_authToken="; \
|
|
echo " Verdaccio detected at $VERDACCIO"; \
|
|
elif wget -q --spider --timeout=3 "$VERDACCIO_LOCAL" 2>/dev/null \
|
|
|| curl -sf --connect-timeout 3 "$VERDACCIO_LOCAL" >/dev/null 2>&1; then \
|
|
LOCAL_REG="$VERDACCIO_LOCAL"; \
|
|
LOCAL_REG_AUTH="//localhost:4873/:_authToken="; \
|
|
echo " Verdaccio detected at $VERDACCIO_LOCAL"; \
|
|
fi \
|
|
&& if [ -n "$LOCAL_REG" ]; then \
|
|
echo "==> Rewriting .npmrc registries → $LOCAL_REG"; \
|
|
sed -i '/\/\/localhost:4873\//d' .npmrc; \
|
|
sed -i '/\/\/localhost:8091\//d' .npmrc; \
|
|
sed -i '/\/\/host.docker.internal/d' .npmrc; \
|
|
sed -i 's|^registry=.*|registry='"$LOCAL_REG"'|' .npmrc; \
|
|
sed -i 's|@esbuild-kit:registry=.*|@esbuild-kit:registry='"$LOCAL_REG"'|' .npmrc; \
|
|
echo "$LOCAL_REG_AUTH" >> .npmrc; \
|
|
else \
|
|
echo ""; \
|
|
echo "========================================================"; \
|
|
echo " WARNING: No local npm registry detected!"; \
|
|
echo "========================================================"; \
|
|
echo ""; \
|
|
echo " @esbuild-kit patched packages will NOT be available."; \
|
|
echo " npm install may fail or use unpatched versions."; \
|
|
echo ""; \
|
|
echo " Start one of these BEFORE building:"; \
|
|
echo ""; \
|
|
echo " Nexus (recommended for desktops):"; \
|
|
echo " cd deployment && docker compose -f docker-compose.nexus.yml up -d"; \
|
|
echo " python3 deployment.py npm publish-patches"; \
|
|
echo ""; \
|
|
echo " Verdaccio (lightweight, for CI runners):"; \
|
|
echo " npx verdaccio --config deployment/verdaccio.yaml &"; \
|
|
echo " python3 deployment.py npm publish-patches --verdaccio"; \
|
|
echo ""; \
|
|
echo " Then rebuild this image."; \
|
|
echo "========================================================"; \
|
|
echo ""; \
|
|
echo " Continuing without local registry — removing scoped overrides..."; \
|
|
sed -i '/@esbuild-kit:registry=/d' .npmrc; \
|
|
sed -i '/\/\/localhost:4873\//d' .npmrc; \
|
|
fi \
|
|
&& echo "==> Final .npmrc:" && cat .npmrc && echo "" \
|
|
&& echo "==> Checking npm registry connectivity..." \
|
|
&& registries=$(grep -E '^\s*(@[^:]+:)?registry=' .npmrc 2>/dev/null | sed 's/.*registry=//' | sort -u) \
|
|
&& for reg in $registries; do \
|
|
printf " %-50s " "$reg"; \
|
|
if wget -q --spider --timeout=5 "$reg" 2>/dev/null \
|
|
|| curl -sf --connect-timeout 5 "$reg" >/dev/null 2>&1; then \
|
|
echo "OK"; \
|
|
else \
|
|
echo "UNREACHABLE"; \
|
|
echo ""; \
|
|
echo "========================================================"; \
|
|
echo "ERROR: Cannot reach npm registry: $reg"; \
|
|
echo "========================================================"; \
|
|
echo ""; \
|
|
echo "If this is a local registry (Verdaccio/Nexus/Artifactory),"; \
|
|
echo "make sure it is running BEFORE building this image:"; \
|
|
echo ""; \
|
|
echo " Verdaccio: npx verdaccio --config deployment/verdaccio.yaml"; \
|
|
echo " Nexus: cd deployment && docker compose -f docker-compose.nexus.yml up -d"; \
|
|
echo ""; \
|
|
echo "Then rebuild with --network=host so the build can reach localhost:"; \
|
|
echo " docker build --network=host -f Dockerfile.node-deps ..."; \
|
|
echo ""; \
|
|
echo "Or remove/comment out the unreachable registry in .npmrc"; \
|
|
echo "========================================================"; \
|
|
exit 1; \
|
|
fi; \
|
|
done \
|
|
&& echo "==> All registries reachable, running npm install..." \
|
|
&& for i in 1 2 3 4 5; do \
|
|
npm install 2>&1 && break; \
|
|
[ "$i" = "5" ] && echo "npm install failed after 5 attempts" && exit 1; \
|
|
echo "npm install failed (attempt $i/5), retrying in $((i*10))s..." && sleep $((i*10)); \
|
|
done
|
|
|
|
# Pre-install Next.js SWC binaries (avoids unreliable CDN download during
|
|
# next build in every frontend — installed once here, reused by all).
|
|
RUN npm install --no-save \
|
|
@next/swc-linux-arm64-musl \
|
|
@next/swc-linux-arm64-gnu \
|
|
2>/dev/null || true
|
|
|
|
LABEL org.metabuilder.image="base-node-deps" \
|
|
org.metabuilder.description="All npm workspace dependencies + Next.js SWC pre-installed"
|