Files
CurrenciCombo/Dockerfile

46 lines
1.7 KiB
Docker
Raw Normal View History

PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
# Multi-stage build for the CurrenciCombo portal (Vite + React).
#
# Context MUST be the repo root so the vite build can see src/, public/,
# index.html, etc.:
#
# docker build -t currencicombo/portal:local .
#
# VITE_ORCHESTRATOR_URL is baked at build time (Vite inlines env vars
# prefixed with VITE_). In a sandbox compose, set it to whatever URL
# the browser uses to reach the orchestrator — typically
# http://localhost:8080 if the orchestrator's port is published on the
# host. When unset, the portal runs in its built-in demo-fallback mode
# (see src/services/orchestrator.ts).
# ------- build stage -------
FROM node:20-alpine AS build
WORKDIR /app
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
ARG VITE_ORCHESTRATOR_URL=""
ENV VITE_ORCHESTRATOR_URL=${VITE_ORCHESTRATOR_URL}
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
COPY package.json package-lock.json ./
# vite 7 ships @rolldown/binding-* as platform-matched optional deps,
# so we MUST include optional deps (skipping them breaks `vite build`
# with "Cannot find native binding"). `fsevents` is also optional but
# darwin-only; on linux npm 10 trips EBADPLATFORM on the lockfile
# entry even though the runtime would never load it. `--force` downgrades
# that EBADPLATFORM to a warning while still installing the rolldown
# binding for the current platform.
RUN npm install --include=optional --force --no-audit --no-fund --ignore-scripts
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
COPY tsconfig.json tsconfig.app.json tsconfig.node.json vite.config.ts index.html eslint.config.js ./
COPY public ./public
COPY src ./src
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
RUN npm run build
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
# ------- runtime stage -------
FROM nginx:1.27-alpine AS runtime
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
PR Z: sandbox deployment scaffolding (deploy script + Dockerfiles + compose) - contracts/scripts/deploy-notary-registry.ts: self-compiling ethers v6 deploy for NotaryRegistry.sol (solc-js in-process — avoids hardhat's HH1006 on contracts/node_modules), with NOTARY_DRY_RUN mode and a machine-readable JSON envelope as last stdout line. - contracts/hardhat.config.ts: chain138 network (RPC defaults to the public endpoint that resolves EXT-CHAIN138-CI-RPC). - orchestrator/Dockerfile: multi-stage node:20-alpine build, non-root user, dumb-init, /health HEALTHCHECK on :8080. - Dockerfile (root, portal): multi-stage vite build → nginx:1.27-alpine, VITE_ORCHESTRATOR_URL baked at build time. - nginx.conf: SPA fallback + long-cache /assets, sourcemaps denied. - docker-compose.yml: full sandbox stack (postgres 15 + redis 7 + orchestrator + portal), all secrets parameterised via env_file. - .env.sandbox.example: template with EXT-* blocker env vars documented and CHAIN_138_RPC_URL defaulting to the resolved public endpoint. - .dockerignore: excludes node_modules, artifacts, cache, terraform, k8s. - orchestrator/src/config/env.ts: emptyToUndefined() preprocess so zod optional regex fields validate empty-string identically to unset (fixes docker-compose NOTARY_REGISTRY_ADDRESS= sandbox booting). Headless smoke test on this box: - docker compose --env-file .env.sandbox up -d → all 4 containers reported Healthy. - curl /ready → {"ready":true} - curl portal / → HTTP 200 with correct <title>. - orchestrator boot log prints all 7 EXT-* IDs (6 active, 1 resolved). - /health returns 503 on this particular builder because memory is 'critical' — DB + Redis both 'up'; this is environment-specific and not caused by PR Z. Unit: 13 suites / 167 tests still pass after env.ts preprocess change. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-22 22:18:20 +00:00
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -q --spider http://127.0.0.1/ || exit 1