Repeated builds grew the VM's disk to 63 GB, until the Mac's disk was full. Writes inside the VM then failed and its file systems broke. - The service image installed dependencies after copying every source file, so each source change rebuilt a 750 MB layer, five images at a time. It now installs from the workspace manifests first, and a test keeps every workspace listed. - The VM's disk defaults to 40 GiB instead of 80. - `up` refuses to create the VM when the Mac has less free space than that, and `build` refuses below 15 GiB free. - After building, superseded images are pruned and the build cache is capped at 10 GB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
3.6 KiB
Docker
86 lines
3.6 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Operators supply reviewed immutable Debian-based Node and Docker CLI images.
|
|
# No credentials or endpoint configuration are baked into this image.
|
|
ARG NODE_IMAGE
|
|
# Tool images are needed only by the targets that copy from them (worker and runner: Docker CLI;
|
|
# provisioner: kubectl). Without one, those targets fail to build instead of using a default.
|
|
ARG DOCKER_CLI_IMAGE=scratch
|
|
ARG KUBECTL_IMAGE=scratch
|
|
FROM ${DOCKER_CLI_IMAGE} AS docker-tools
|
|
FROM ${KUBECTL_IMAGE} AS kubectl-tools
|
|
|
|
FROM ${NODE_IMAGE} AS runtime
|
|
USER root
|
|
RUN apt-get update && apt-get install -y --no-install-recommends git python3 bubblewrap ca-certificates tini \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /opt/wishforge
|
|
# The manifests of every workspace first: dependencies install once and stay cached while only
|
|
# sources change. A new workspace needs its line here, or npm ci fails.
|
|
COPY package.json package-lock.json tsconfig.base.json ./
|
|
COPY apps/api/package.json ./apps/api/
|
|
COPY apps/web/package.json ./apps/web/
|
|
COPY apps/worker/package.json ./apps/worker/
|
|
COPY apps/runner/package.json ./apps/runner/
|
|
COPY apps/git-service/package.json ./apps/git-service/
|
|
COPY apps/provisioner/package.json ./apps/provisioner/
|
|
COPY packages/agent/package.json ./packages/agent/
|
|
COPY packages/artifacts/package.json ./packages/artifacts/
|
|
COPY packages/contracts/package.json ./packages/contracts/
|
|
COPY packages/github/package.json ./packages/github/
|
|
COPY packages/runtime/package.json ./packages/runtime/
|
|
RUN npm ci --ignore-scripts --no-audit --no-fund
|
|
COPY apps/api ./apps/api
|
|
COPY apps/web ./apps/web
|
|
COPY apps/worker ./apps/worker
|
|
COPY apps/runner ./apps/runner
|
|
COPY apps/git-service ./apps/git-service
|
|
COPY apps/provisioner ./apps/provisioner
|
|
COPY packages ./packages
|
|
COPY scripts/build-services.mjs ./scripts/
|
|
# Services run as built JavaScript (dist/), not TypeScript transpiled at start-up.
|
|
RUN node scripts/build-services.mjs \
|
|
&& node -e "Promise.all([import('@temporalio/worker'),import('@openai/codex-sdk')]).then(()=>console.log('runtime dependencies loaded'))"
|
|
ENV NODE_ENV=production
|
|
USER node
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
CMD ["node", "dist/api/main.mjs"]
|
|
|
|
FROM runtime AS worker
|
|
USER root
|
|
COPY --from=docker-tools /usr/local/bin/docker /usr/local/bin/docker
|
|
COPY --from=docker-tools /usr/local/libexec/docker/cli-plugins/docker-buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
|
|
USER node
|
|
CMD ["node", "dist/worker/main.mjs"]
|
|
|
|
FROM worker AS runner
|
|
CMD ["node", "dist/runner/main.mjs"]
|
|
|
|
FROM runtime AS git-storage
|
|
CMD ["node", "dist/git-service/main.mjs"]
|
|
|
|
FROM runtime AS web
|
|
# development is for local development clusters only (scripts/k3s-local.mjs): the web's development
|
|
# sign-in exists only in a development build, so production images never contain it.
|
|
ARG WEB_BUILD=production
|
|
USER root
|
|
RUN case "$WEB_BUILD" in \
|
|
production) ;; \
|
|
development) export NODE_ENV=development WF_WEB_DEVELOPMENT_BUILD=true ;; \
|
|
*) echo "WEB_BUILD must be production or development" >&2; exit 1 ;; \
|
|
esac \
|
|
&& npm run build -w @wishforge/web && chown -R node:node apps/web/.next
|
|
USER node
|
|
ENV NODE_ENV=${WEB_BUILD}
|
|
EXPOSE 3000
|
|
CMD ["node", "node_modules/next/dist/bin/next", "start", "apps/web", "--hostname", "0.0.0.0", "--port", "3000"]
|
|
|
|
# The Kubernetes backend applies resources with kubectl; the operator's image supplies a reviewed binary.
|
|
FROM runtime AS provisioner
|
|
ARG KUBECTL_PATH=/usr/local/bin/kubectl
|
|
USER root
|
|
COPY --from=kubectl-tools ${KUBECTL_PATH} /usr/local/bin/kubectl
|
|
USER node
|
|
ENV WF_PROVISIONER_BACKEND=kubernetes WF_PROVISIONER_HOST=0.0.0.0
|
|
EXPOSE 4450
|
|
CMD ["node", "apps/provisioner/main.mjs"]
|