FROM node:14-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage
RUN pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Build the core library in both lib and esm formats
RUN pnpm --filter 'wujie-core' run lib
RUN pnpm --filter 'wujie-core' run esm
# Final runtime image
FROM node:14-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
node_modules dist lib esm .dockerignore Dockerfile pnpm-lock.yaml pnpm-lock.yaml.bak .git *.log coverage
Summary (under 1500 chars):
- Exact error message and exit code
- Exit code: 100
- The build failed with: "ERROR: failed to build: failed to solve: process \"/bin/sh -c apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && rm -rf /var/lib/apt/lists/*\" did not complete successfully: exit code: 100"
- The repository errors:
- E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
- E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file.
- E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
- Failing command/step
- RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && rm -rf /var/lib/apt/lists/*
- Dockerfile reference: line 7 (as shown in the log: Dockerfile:7)
- Missing packages or files mentioned
- Packages intended to install: git, ca-certificates, python3, build-essential
- The failure is due to apt-get not being able to fetch Release files from Debian repositories
- Version mismatch info
- Base image is Node:14-slim, which resolves to a Debian buster (Debian 10) variant
- Debian buster Release files are no longer available (End-of-Life), causing 404/Release file errors
- Action needed: upgrade the base image to a supported Debian version (e.g., bullseye/bookworm) or adjust apt sources to a supported releaseFROM node:14-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage
RUN pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"
# Build the core library in both lib and esm formats
RUN pnpm --filter 'wujie-core' run lib
RUN pnpm --filter 'wujie-core' run esm
# Final runtime image
FROM node:14-bullseye-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
- Failing step/command: - [builder 6/8] RUN pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**" - Exact error message and exit code: - " ERROR Headless installation requires a pnpm-lock.yaml file" - "pnpm: Headless installation requires a pnpm-lock.yaml file" - Exit code: 1 - Missing packages/files mentioned: - pnpm-lock.yaml file is missing (required for headless installation) - Version/environment context: - Base image: node:14-bullseye-slim - PNPM version: 7.9.5 - No explicit version mismatch noted in the log - Summary: The build fails during a headless pnpm install due to a missing pnpm-lock.yaml. Ensure a pnpm-lock.yaml exists at the repo root (or run a normal install to generate it before using --frozen-lockfile).
node_modules dist lib esm .dockerignore Dockerfile pnpm-lock.yaml.bak .git *.log coverage
Error: file exceeds 512KB limit (1149141 bytes)
Error: file exceeds 512KB limit (1149141 bytes)
{
"name": "wujie-project",
"version": "0.0.0",
"description": "极致的微前端框架",
"private": true,
"scripts": {
"start": "lerna run start --parallel",
"doc": "lerna run docs:dev",
"clean": "rimraf node_modules **/*/node_modules",
"test": "lerna run test --scope wujie",
"commitlint": "commitlint -E COMMIT_EDITMSG_PATH",
"husky-commitlint": "commitlint -e",
"prepare": "husky install"
},
"repository": {
"type": "git",
"url": "https://github.com/Tencent/wujie.git"
},
"author": "yiludege",
"license": "MIT",
"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@lerna-lite/cli": "^1.11.1",
"@lerna-lite/run": "^1.11.1",
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
"rimraf": "^3.0.2"
},
"dependencies": {}
}
FROM node:16-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage when available
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"; \
else \
pnpm install --filter "wujie-project" --filter "./packages/**"; \
fi
# Build the core library in both lib and esm formats
RUN pnpm --filter 'wujie-core' run lib
RUN pnpm --filter 'wujie-core' run esm
# Final runtime image
FROM node:16-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
Summary:
- Failing step (command): [stage-1 3/5] RUN apt-get update && apt-get install -y --no-install-recommends python3 && rm -rf /var/lib/apt/lists/*
- Exact error message and exit code:
- "ERROR: failed to build: failed to solve: process \"/bin/sh -c apt-get update && apt-get install -y --no-install-recommends python3 && rm -rf /var/lib/apt/lists/*\" did not complete successfully: exit code: 100"
- The apt steps fail with repository errors:
- "E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file."
- "0.361 Err:4 http://deb.debian.org/debian buster Release"
- "0.366 Err:5 http://deb.debian.org/debian-security buster/updates Release"
- "0.372 Err:6 http://deb.debian.org/debian buster-updates Release"
- "E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file."
- "E: The repository 'http://deb.debian.org/debian-security buster/updates Release' does not have a Release file."
- "E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file."
- Missing packages or files mentioned:
- python3 (the package being installed)
- Release files for Debian "buster" repositories (not found)
- Version mismatch / root cause:
- The build attempts to install python3 via apt-get in a base that references Debian repo buster, but those Release files are not available (buster is an outdated Debian release).
- This indicates a Debian release mismatch: the base image uses a newer Debian (e.g., bullseye/slim) while the apt sources attempt to use the old buster repositories.FROM node:16-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage when available
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"; \
else \
pnpm install --filter "wujie-project" --filter "./packages/**"; \
fi
# Build the core library in both lib and esm formats
RUN pnpm --filter 'wujie-core' run lib
RUN pnpm --filter 'wujie-core' run esm
# Final runtime image
FROM node:16-bullseye-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
Summary: - VerifyBuild status: build_failed - Failing steps: - COPY --from=builder /workspace/packages/wujie-core/lib ./lib (stage-1 4/5) - COPY --from=builder /workspace/packages/wujie-core/esm ./esm (stage-1 5/5) - Missing artifacts: - /workspace/packages/wujie-core/lib - /workspace/packages/wujie-core/esm - Context: expected artifacts from builder stage but not produced - Error messages: - ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::n1m5q4hunmnpb65qiazjyibax: "/workspace/packages/wujie-core/lib": not found - ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::n1m5q4hunmnpb65qiazjyibax: "/workspace/packages/wujie-core/esm": not found - Exit code: not shown in log - Version notices: - Using base image: node:16-bullseye-slim - PNPM update: 7.9.5 → 10.32.1 - npm update: 8.19.4 → 11.11.1 - Builder log: No projects matched the filters in "/workspace" (affecting lib/esm generation) - Builder context: - pnpm workspaces/filters; steps 7/8 and 8/8 show no projects matched for wujie-core, explaining why lib and esm were not generated and causing the COPY errors - Concerns / recommendations: - Add a basic runtime check (e.g., require a file) or small test script to exercise built lib/esm - Ensure a .dockerignore exists to avoid shipping full repo context (e.g., node_modules, unnecessary build artifacts) - Validate COPY paths against actual builder outputs; document expected outputs to prevent breakage if build layout changes
FROM node:16-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage when available
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"; \
else \
pnpm install --filter "wujie-project" --filter "./packages/**"; \
fi
# Build the core library in both lib and esm formats
RUN pnpm --filter "./packages/wujie-core" run lib
RUN pnpm --filter "./packages/wujie-core" run esm
# Final runtime image
FROM node:16-bullseye-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
Concerns: The final CMD only prints a readiness message; it doesn't exercise runtime functionality beyond confirming artifacts exist., Relies on a proper .dockerignore to avoid shipping large files (like node_modules) into the build context; ensure one exists in the repo., If the build outputs change (paths for lib/esm), the COPY commands in the final stage may break; consider validating artifact paths or making the paths configurable.
Smoke [PASS]: test -f /usr/local/wujie/lib/index.js
Smoke [PASS]: test -f /usr/local/wujie/esm/index.js
Smoke [FAIL]: node -e "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')
Output: sh: 1: Syntax error: Unterminated quoted stringFROM node:16-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage when available
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"; \
else \
pnpm install --filter "wujie-project" --filter "./packages/**"; \
fi
# Build the core library in both lib and esm formats
RUN pnpm --filter "./packages/wujie-core" run lib
RUN pnpm --filter "./packages/wujie-core" run esm
# Final runtime image
FROM node:16-bullseye-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Provide a simple default command to indicate readiness
CMD ["node", "-e", "console.log('wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie')"]
Smoke [PASS]: test -d /usr/local/wujie/lib && test -d /usr/local/wujie/esm
Smoke [PASS]: ls -la /usr/local/wujie/lib | head -n 1
Smoke [FAIL]: node -e "console.log('node ok', process.version)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM node:16-bullseye-slim AS builder
# Set working directory for building the project
WORKDIR /workspace
# Install system dependencies required for building native modules and git access
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates python3 build-essential && \
rm -rf /var/lib/apt/lists/*
# Install pnpm (matching CI's version for reproducibility)
RUN npm i -g pnpm@7.9.5
# Copy repository files
COPY . .
# Install dependencies for the workspace with strict lockfile usage when available
RUN if [ -f pnpm-lock.yaml ]; then \
pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**"; \
else \
pnpm install --filter "wujie-project" --filter "./packages/**"; \
fi
# Build the core library in both lib and esm formats
RUN pnpm --filter "./packages/wujie-core" run lib
RUN pnpm --filter "./packages/wujie-core" run esm
# Final runtime image
FROM node:16-bullseye-slim
# Set working directory for runtime
WORKDIR /usr/local/wujie
# Install minimal runtime dependencies (python3 kept for potential native bindings during consumption)
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder stage
COPY --from=builder /workspace/packages/wujie-core/lib ./lib
COPY --from=builder /workspace/packages/wujie-core/esm ./esm
# Add a small verification script and set as entrypoint
RUN echo 'console.log("wujie-core artifacts ready. lib/index.js and esm/index.js are available under /usr/local/wujie");' > /usr/local/wujie/verify.js
CMD ["node", "/usr/local/wujie/verify.js"]
Concerns: Assumes wujie-core lib/index.js and esm/index.js exist after build; if the build outputs different filenames or paths, the smoke checks will fail., COPY . . in the builder stage may copy unnecessary files (like node_modules or large history) into the build context; consider adding a .dockerignore to keep the context lean. Smoke [FAIL]: test -f /usr/local/wujie/lib/index.js && echo 'lib/index.js present' || echo 'lib/index.js missing Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: test -f /usr/local/wujie/esm/index.js && echo 'esm/index.js present' || echo 'esm/index.js missing Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: node -v
# syntax=docker/dockerfile:1 # Builder stage: compile the monorepo using pnpm FROM node:18-bullseye-slim AS builder # Install essential build tools RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace # Install a specific pnpm version for reproducibility RUN npm i -g pnpm@7.9.5 # Copy repository COPY . . # Install dependencies for the workspace with frozen lockfile RUN pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**" # Build the targeted library in wujie-core (lib and esm outputs) RUN pnpm --filter 'wujie-core' run lib RUN pnpm --filter 'wujie-core' run esm # Runtime stage: only keep built artifacts and minimal runtime FROM node:18-bullseye-slim AS runtime # Install essential runtime dependencies RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates python3 build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/local/wujie # Copy build artifacts from builder COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm # Default to a non-intrusive shell; the image primarily serves as a build artifact container CMD ["bash"]
# Ignore node_modules everywhere and build artifacts locally node_modules **/node_modules dist lib esm coverage .vscode .idea .DS_Store
- Status: VerifyBuild status: build_failed
- Concerns
- Runtime stage installs build tools (python3, build-essential) not needed for runtime; may bloat image.
- COPY . . may copy large or sensitive files; ensure .dockerignore excludes node_modules and build artifacts.
- Smoke tests only verify directory existence; consider a lightweight runtime check if feasible.
- Build error (exact messages)
- ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::mx3gce050ofi34vzoyd0uryw1: "/workspace/packages/wujie-core/esm": not found
- ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::mx3gce050ofi34vzoyd0uryw1: "/workspace/packages/wujie-core/lib": not found
- Failing command/step
- [runtime 5/5] COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm
- [runtime 4/5] COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib
- Dockerfile lines:
COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib
COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm
- Missing packages/files mentioned
- /workspace/packages/wujie-core/esm
- /workspace/packages/wujie-core/lib
- Context: builder steps 15 and 16 report “No projects matched the filters in "/workspace"”, so these artifacts were not produced.
- Version/info
- PNPM update: 7.9.5 → 10.32.1 available
- Node image: node:18-bullseye-slim; Puppeteer installs Chromium
- No explicit version mismatch error reported
- Likely cause and quick fix
- Cause: Builder did not produce wujie-core outputs due to filters not matching any projects ("No projects matched the filters").
- Fix: Align PNPM filters with actual workspace projects (correct path/name for wujie-core) or remove restrictive filters. Ensure /workspace/packages/wujie-core/esm and /workspace/packages/wujie-core/lib are generated before COPY steps; adjust Dockerfile/build context accordingly. Verify artifact creation prior to COPY.# syntax=docker/dockerfile:1 # Builder stage: compile the monorepo using pnpm FROM node:18-bullseye-slim AS builder # Install essential build tools RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace # Install a specific pnpm version for reproducibility RUN npm i -g pnpm@7.9.5 # Copy repository COPY . . # Install dependencies for the workspace with frozen lockfile; target wujie project and all packages RUN pnpm install --frozen-lockfile --filter "wujie-project" --filter "./packages/**" # Build the targeted library in wujie-core (lib and esm outputs) RUN pnpm --filter 'wujie' run lib RUN pnpm --filter 'wujie' run esm # Runtime stage: only keep built artifacts and minimal runtime FROM node:18-bullseye-slim AS runtime # Copy build artifacts from builder WORKDIR /usr/local/wujie COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm # Default to a non-intrusive shell; the image primarily serves as a build artifact container CMD ["bash"]
Concerns: Runtime image does not install bash; the CMD uses bash which may not exist on debian bullseye-slim, causing container startup to fail. Consider using /bin/sh or install bash in the runtime image., Relies on build outputs at /workspace/packages/wujie-core/lib and esm; if pnpm build emits different paths, the COPY steps will fail. Verify the actual output directories match., Filters in pnpm install (--filter 'wujie-project' and --filter './packages/**') assume a specific workspace layout; ensure these filters align with the monorepo structure to avoid build errors.
Smoke [PASS]: test -d /usr/local/wujie/lib && test -d /usr/local/wujie/esm && echo ok
Smoke [FAIL]: node -e 'try { require("/usr/local/wujie/lib/index.js"); console.log("lib-ok"); } catch (e) { console.error("lib-error", e); process.exit(1); }
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: node -e 'try { require("/usr/local/wujie/esm/index.js"); console.log("esm-ok"); } catch (e) { console.error("esm-error", e); process.exit(1); }
Output: sh: 1: Syntax error: Unterminated quoted string# syntax=docker/dockerfile:1 # Builder stage: compile the monorepo using pnpm FROM node:18-bullseye-slim AS builder # Install essential build tools RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace # Install a specific pnpm version for reproducibility RUN npm i -g pnpm@7.9.5 # Copy repository COPY . . # Install dependencies for the workspace with frozen lockfile RUN pnpm install --frozen-lockfile --filter "./packages/**" --filter "wujie-project" # Build the wujie-core library (lib and esm outputs) RUN pnpm --filter "./packages/wujie-core" run lib RUN pnpm --filter "./packages/wujie-core" run esm # Runtime stage: only keep built artifacts and minimal runtime FROM node:18-bullseye-slim AS runtime # Install runtime dependencies (kept lightweight) RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/local/wujie # Copy build artifacts from builder COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm # Default to a shell; the image primarily serves as a build artifact container CMD ["bash"]
Concerns: The runtime image may not include bash, yet the Dockerfile sets CMD ["bash"]. If the entrypoint is not overridden, the container could fail to start. The smoke tests do override entrypoint, but this could be brittle for users., The COPY --from=builder steps assume the build outputs exist at /workspace/packages/wujie-core/lib and /workspace/packages/wujie-core/esm. If the build fails or paths differ, the runtime image build will fail. Smoke [PASS]: test -d /usr/local/wujie/lib && test -d /usr/local/wujie/esm Smoke [FAIL]: test -n "$(ls -1A /usr/local/wujie/lib 2>/dev/null | head -n1) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: test -n "$(ls -1A /usr/local/wujie/esm 2>/dev/null | head -n1) Output: sh: 1: Syntax error: Unterminated quoted string
# syntax=docker/dockerfile:1 # Builder stage: compile the monorepo using pnpm FROM node:18-bullseye-slim AS builder # Install essential build tools RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates python3 build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /workspace # Install a specific pnpm version for reproducibility RUN npm i -g pnpm@7.9.5 # Copy repository COPY . . # Install dependencies for the workspace with frozen lockfile; only build the wujie-core package via path filter RUN pnpm install --frozen-lockfile --filter "./packages/wujie-core" # Build the wujie-core library (lib and esm outputs) RUN pnpm --filter "./packages/wujie-core" run lib RUN pnpm --filter "./packages/wujie-core" run esm # Runtime stage: only keep built artifacts and minimal runtime FROM node:18-bullseye-slim AS runtime # Install runtime dependencies (kept lightweight) RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/local/wujie # Copy build artifacts from builder COPY --from=builder /workspace/packages/wujie-core/lib /usr/local/wujie/lib COPY --from=builder /workspace/packages/wujie-core/esm /usr/local/wujie/esm # Default to a minimal shell; the image primarily serves as a build artifact container CMD ["/bin/sh"]
Concerns: CMD uses /bin/sh in runtime; not a meaningful runtime entry for a library artifact. Consider setting a non-interactive entrypoint or using a more conventional runtime approach for library packaging., Runtime image contains only built artifacts with no package manager or runtime bindings; consumers may need to provide their own environment to use the library. This is acceptable for a build artifact, but document expected usage., If the build outputs or their paths change (e.g., lib/esm directories), the COPY steps could break. Consider validating paths or making the artifact layout more explicit. Smoke [PASS]: test -d /usr/local/wujie/lib && test -d /usr/local/wujie/esm Smoke [PASS]: ls -la /usr/local/wujie/lib | head -n 5 Smoke [PASS]: ls -la /usr/local/wujie/esm | head -n 5