|
| 1 | +# ── Stage 1: builder ───────────────────────────────────────────────────────── |
| 2 | +# Installs all dependencies and builds every workspace package from source. |
| 3 | +# Nothing is downloaded from the npm registry for @abapify/* packages. |
| 4 | +FROM node:24-bookworm AS builder |
| 5 | + |
| 6 | +# Install bun (matches the version used in CI) |
| 7 | +RUN npm install -g bun@1.2.9 |
| 8 | + |
| 9 | +WORKDIR /build |
| 10 | + |
| 11 | +# Copy workspace manifests first for better layer caching |
| 12 | +COPY package.json bun.lock nx.json tsconfig.base.json tsconfig.json ./ |
| 13 | + |
| 14 | +# Copy all workspace members required for the build |
| 15 | +COPY packages/ ./packages/ |
| 16 | +COPY tools/ ./tools/ |
| 17 | +COPY samples/ ./samples/ |
| 18 | + |
| 19 | +# Install all dependencies (including dev deps needed for the build) |
| 20 | +RUN bun install --frozen-lockfile |
| 21 | + |
| 22 | +# Build every package (Nx respects the dependency graph, so output is correct) |
| 23 | +RUN npx nx run-many -t build --all --parallel=4 |
| 24 | + |
| 25 | +# ── Stage 2: runner ────────────────────────────────────────────────────────── |
| 26 | +# Lean image that ships only the built artifacts and their runtime deps. |
| 27 | +# The adt CLI and all plugins are available without any npm registry access. |
| 28 | +FROM node:24-bookworm-slim |
| 29 | + |
| 30 | +WORKDIR /app |
| 31 | + |
| 32 | +# Copy the built workspace packages (dist/ directories are now populated) |
| 33 | +COPY --from=builder /build/packages ./packages |
| 34 | +# Copy the workspace node_modules so @abapify/* symlinks resolve correctly |
| 35 | +# and third-party runtime deps (commander, axios, etc.) are present |
| 36 | +COPY --from=builder /build/node_modules ./node_modules |
| 37 | +# Copy the root package.json so npm workspace resolution works at runtime |
| 38 | +COPY --from=builder /build/package.json ./ |
| 39 | + |
| 40 | +# Expose workspace binaries (adt, adt-codegen, …) as global commands |
| 41 | +ENV PATH="/app/node_modules/.bin:$PATH" |
| 42 | + |
| 43 | +CMD ["adt", "--help"] |
0 commit comments