FROM node:16-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --silent
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:16-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
node_modules build dist coverage .vscode .idea .DS_Store *.log .env .env.* .dockerignore Dockerfile *.swp *.swo *.tmp *.pci-archive .cache *.lock
"ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates bash git python3 build-essential && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100"
- Follow-on apt error cause: The repository updates could not be retrieved because the Release files were not found
- Failing command/step: [build 2/7] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates bash git python3 build-essential && rm -rf /var/lib/apt/lists/*
- Missing packages/files mentioned:
- apt-get update failed due to missing Release files for Debian repositories:
- 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.
- Version mismatch / root cause:
- The base image attempts to use Debian "buster" (Debian 10) repositories, which are EOL and no longer have Release files.
- OS mismatch: Node base image is node:16-slim; build tries to install system packages on top of Debian Buster repos.
- Notes:
- Subsequent stage shows cancellation due to the earlier failure (e.g., npm install reported as container process already dead), but the primary error is the apt repository issue.
- Recommendation:
- Switch to a newer Debian base (e.g., bullseye or bookworm) or pin a node:16-slim variant based on a currently supported Debian release.
- Or update apt sources to a supported Debian release.
- Key actionable items:
- Update Dockerfile base image to a supported Debian variant.
- Rebuild with updated apt sources or a newer Node-based image.
- Context: base image node:16-slim; affected packages being installed via apt-get: ca-certificates, bash, git, python3, build-essential.FROM node:16-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --silent
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:16-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
- Exact error message and exit code: - ERROR: process "/bin/sh -c npm ci --silent" did not complete successfully: exit code: 1 - Failing command/step: - [build 5/7] RUN npm ci --silent (Dockerfile:19) - Missing packages or files mentioned: - None explicitly mentioned. The log shows the failure during npm ci, with no specific missing file/package error reported. - Version mismatch / warnings: - Warning observed: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) - Version notice: New major version of npm available! 8.19.4 -> 11.12.0 (appears in the log at multiple points) - Context notes: - Base image is node:16-bullseye-slim with a long apt-get install step preceding npm usage. - The error occurs after copying package.json and package-lock.json and attempting npm ci.
FROM node:16-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
# Use npm install to maximize compatibility in the container
RUN npm install --silent --legacy-peer-deps
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:16-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
- Exact error message and exit code: - ERROR: process "/bin/sh -c npm install --silent --legacy-peer-deps" did not complete successfully: exit code: 1 - Failing command/step: - [build 5/7] RUN npm install --silent --legacy-peer-deps - Missing packages or files mentioned: - None explicitly mentioned - Version mismatch info: - New major version of npm available! 8.19.4 -> 11.12.0 - Changelog: https://github.com/npm/cli/releases/tag/v11.12.0 - Suggested update: Run npm install -g npm@11.12.0
FROM node:16-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifest first to leverage Docker cache
COPY package.json ./
# Install yarn and use it to install workspaces
RUN npm install -g yarn
RUN yarn install --silent
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:16-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Summary (under 1500 chars): - Failing step: [build 5/8] RUN npm install -g yarn - Exit code: 1 - Exact error message (from build output): npm ERR! code EEXIST npm ERR! path /usr/local/bin/yarnpkg npm ERR! EEXIST: file already exists npm ERR! File exists: /usr/local/bin/yarnpkg npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2026-03-23T18_53_06_149Z-debug-0.log - Missing packages/files mentioned: There is a conflict due to an existing file at /usr/local/bin/yarnpkg when attempting to install yarn globally (suggests removing the file or using --force). - Version mismatch information present: New major version of npm available! 8.19.4 -> 11.12.0 - Context notes: Dockerfile shows the step intended to install yarn and then run yarn install, but the build failed at this npm install -g yarn step.
FROM node:16-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifest first to leverage Docker cache
COPY package.json ./
# Install yarn and use it to install workspaces
RUN corepack enable || true
RUN corepack prepare yarn@1.22.19 --activate || true
# Use yarn to install dependencies for workspaces
RUN yarn install --silent
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN yarn build
# Final runtime image with just the built app
FROM node:16-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN corepack enable || true
RUN corepack prepare yarn@1.22.19 --activate || true
# Install serve in the runtime image
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Summary of Docker build error - Failing step - [build 7/9] RUN yarn install --silent - Exact error messages (preserved) - 25.77 error expect@30.3.0: The engine "node" is incompatible with this module. Expected version "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0". Got "16.20.2" - 25.78 error Found incompatible module. - Exit code - ERROR: process "/bin/sh -c yarn install --silent" did not complete successfully: exit code: 1 - Missing packages or files mentioned - Package: expect@30.3.0 (engine mismatch) - Root cause: The engine requirement for expect@30.3.0 specifies Node versions ^18.14.0, ^20.0.0, ^22.0.0, or >=24.0.0, but the base image provides Node 16.20.2 (node:16-bullseye-slim). - Version mismatch information - Base image Node version: 16.20.2 - Required by failing module: Node versions ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0 - Therefore, the build fails due to an engine incompatibility between Node 16.20.2 and expect@30.3.0.
FROM node:18-bullseye-slim as build
# Install system dependencies necessary for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy lockfile and package.json to install dependencies first
COPY package.json package-lock.json ./
# Install dependencies (production and dev as defined by the lockfile)
RUN npm ci --silent
# Copy the rest of the source
COPY . ./
# Build the project from source
RUN npm run build
# Runtime image
FROM node:18-bullseye-slim
WORKDIR /app
# Serve the built app with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Summary (under 1500 chars): - Exact error message and exit code - ERROR: process "/bin/sh -c npm ci --silent" did not complete successfully: exit code: 1 - Failing command/step - [build 5/7] RUN npm ci --silent - Missing packages or files mentioned - No explicit missing package/file errors were reported. The log shows npm ci failed, but no specific missing-file message. - Version mismatch info - New major version of npm available! 10.8.2 -> 11.12.0 Notes: - The failure occurs after copying package.json and package-lock.json, during the npm ci step, which expects a valid lockfile and dependencies. No concrete missing-file mention is shown in the snippet.
FROM node:18-bullseye-slim as build
# Install system dependencies for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --silent
# Copy the rest of the source
COPY . ./
# Build the project from source
RUN npm run build
# Final runtime image with just the built app
FROM node:18-bullseye-slim
WORKDIR /app
# Serve the built app with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 904B 0.0s done #1 DONE 0.1s #2 [internal] load metadata for docker.io/library/node:18-bullseye-slim #2 DONE 0.2s #3 [internal] load .dockerignore #3 transferring context: 188B done #3 DONE 0.0s #4 [internal] load build context #4 DONE 0.0s #5 [build 1/7] FROM docker.io/library/node:18-bullseye-slim@sha256:d69fb189fa7765636655db043a6a9e6be5ddf94bd1a8dc33fd0bcf4664606a9e #5 resolve docker.io/library/node:18-bullseye-slim@sha256:d69fb189fa7765636655db043a6a9e6be5ddf94bd1a8dc33fd0bcf4664606a9e #5 resolve docker.io/library/node:18-bullseye-slim@sha256:d69fb189fa7765636655db043a6a9e6be5ddf94bd1a8dc33fd0bcf4664606a9e 0.1s done #5 DONE 0.1s #6 [stage-1 2/4] WORKDIR /app #6 CACHED #7 [stage-1 3/4] RUN npm install -g serve #7 CACHED #4 [internal] load build context #4 transferring context: 46.86kB 0.1s done #4 DONE 0.1s #8 [build 2/7] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates bash git python3 build-essential && rm -rf /var/lib/apt/lists/* #8 CACHED #9 [build 3/7] WORKDIR /app #9 CACHED #10 [build 4/7] COPY package.json package-lock.json ./ #10 CACHED #11 [build 5/7] RUN npm ci --silent #11 ERROR: process "/bin/sh -c npm ci --silent" did not complete successfully: exit code: 1 ------ > [build 5/7] RUN npm ci --silent: ------ [33m1 warning found (use docker --debug to expand): [0m - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) Dockerfile:19 -------------------- 17 | 18 | # Install dependencies for the whole monorepo (workspaces) 19 | >>> RUN npm ci --silent 20 | 21 | # Copy the rest of the source -------------------- ERROR: failed to build: failed to solve: process "/bin/sh -c npm ci --silent" did not complete successfully: exit code: 1
FROM node:18-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm install --silent --legacy-peer-deps
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:18-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Actionable summary:
- VerifyBuild status: build_failed
- Build concerns:
- COPY package.json package-lock.json may fail if package-lock.json is not present; monorepos sometimes use yarn or a different lockfile.
- Ensure .dockerignore excludes node_modules to avoid copying host dependencies and to keep the image slim.
- Build error details:
- Step: [build 5/7] RUN npm install --silent --legacy-peer-deps
- Command: npm install --silent --legacy-peer-deps
- Exit: exit code 1
- Dockerfile location: Dockerfile:19
- Dockerfile snippet around issue:
17 |
18 |
19 | >>> RUN npm install --silent --legacy-peer-deps
20 |
21 | # Copy the rest of the source
- Warning observed: "1 warning found (use docker --debug to expand): FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)"
- Resulting error message: "ERROR: failed to build: failed to solve: process \"/bin/sh -c npm install --silent --legacy-peer-deps\" did not complete successfully: exit code: 1"
- Environment details:
- Base image: docker.io/library/node:18-bullseye-slim@sha256:d69fb189fa7765636655db043a6a9e6be5ddf94bd1a8dc33fd0bcf4664606a9e
- Build context steps observed: [internal] load build definition, [internal] load metadata for node:18-bullseye-slim, [internal] load .dockerignore, [build 1/7] FROM ..., [build 4/7] COPY package.json package-lock.json ./ (CACHED), [build 5/7] RUN npm install --silent --legacy-peer-deps (ERROR)
- File/command references to note:
- package.json
- package-lock.json
- Dockerfile:19
- Base image reference: node:18-bullseye-slim@sha256:d69fb189fa7765636655db043a6a9e6be5ddf94bd1a8dc33fd0bcf4664606a9eFROM node:20-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --silent --legacy-peer-deps
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:20-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Summary (under 1500 chars): - Exact error message and exit code: ERROR: process "/bin/sh -c npm ci --silent --legacy-peer-deps" did not complete successfully: exit code: 1 - Failing command/step: [build 5/7] RUN npm ci --silent --legacy-peer-deps - Warnings or messages preserved: 1 warning found (use docker --debug to expand): - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) Dockerfile:19 - Missing packages or files mentioned: None reported. The log shows a casing warning and an npm/npm-version notice, but no explicit missing files or packages needed for npm ci. - Version mismatch / info: - Base image: node:20-bullseye-slim - npm major version update notice observed: New major version of npm available! 10.8.2 -> 11.12.0 Notes: - The failure occurs during the npm ci step after a long apt-get install prior step completed. The only reported issue related to the failure is the Dockerfile casing warning preceding the npm ci failure.
FROM node:18-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --loglevel verbose --silent=false || npm install --loglevel verbose --silent=false
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build --loglevel verbose
# Final runtime image with just the built app
FROM node:18-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
- Failing step: [build 7/7] RUN npm run build --loglevel verbose
- Exit code: 1
- Exact error message and context:
Error: Cannot find module 'react-dev-utils/crossSpawn'
Require stack:
- /app/packages/react-scripts/bin/react-scripts.js
{
code: 'MODULE_NOT_FOUND',
...
}
Node.js v18.20.8
npm verbose exit 1
- Missing packages/files mentioned:
- Missing module: react-dev-utils/crossSpawn (module not found during React Scripts build)
- Version/mismatch information:
- Node.js: v18.20.8
- npm: v10.8.2
- Base image: node:18-bullseye-slim (as seen in the build steps)
- Additional context:
- The error occurs during the CRA build step invoked by npm run build, after npm ci completed.FROM node:18-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache if available
COPY package.json package-lock.json ./
# Enable corepack and use Yarn for workspaces compatibility
RUN corepack enable || true
RUN corepack prepare yarn@1.22.19 --activate || true
# Copy the rest of the source
COPY . ./
# Install dependencies for the whole monorepo (workspaces)
RUN yarn install --silent
# Build the project from source (this will build the CRA React Scripts from source)
RUN yarn build
# Final runtime image with just the built app
FROM node:18-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
- Exact error message and exit code - The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.20.8" - Found incompatible module. - ERROR: failed to build: failed to solve: process "/bin/sh -c yarn install --silent" did not complete successfully: exit code: 1 - Failing command/step - [build 8/9] RUN yarn install --silent - Exit code: 1 - Missing packages or files mentioned - None explicitly listed as missing; issue is Node engine compatibility for a dependency. - Version mismatch info - Node version in use: 18.20.8 - Mis-matching module: lru-cache@11.2.7 requires Node 20 or >=22
FROM node:20-bullseye-slim as build
# Install system dependencies required for building native modules
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
bash \
git \
python3 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package manifests first to leverage Docker cache
COPY package.json package-lock.json ./
# Install dependencies for the whole monorepo (workspaces)
RUN npm ci --silent
# Copy the rest of the source
COPY . ./
# Build the project from source (this will build the CRA React Scripts from source)
RUN npm run build
# Final runtime image with just the built app
FROM node:20-bullseye-slim
WORKDIR /app
# Serve the static build with a lightweight static server
RUN npm install -g serve
# Copy built assets from the build stage
COPY --from=build /app/build ./build
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
Summary (under 1500 chars): - VerifyBuild status: build_failed - Key concerns: - COPY . ./ may copy host node_modules if .dockerignore doesn’t exclude them; add a .dockerignore to exclude node_modules and other nonessential files. - If this is a monorepo with workspaces, ensure npm ci installs all packages (potential need for --workspaces or a defined build script). - CRA build outputs to /app/build as assumed; add validation in the final image to ensure build output exists and that the server binary (serve) is present. - The Dockerfile looks reasonable but relies on CRA output location being /app/build. - Build error details: - Base image: node:20-bullseye-slim - Stage: /app as working directory; install of serve globally occurs - Steps include: apt-get install (ca-certificates, bash, git, python3, build-essential) - Copy: COPY package.json package-lock.json ./ - Command failing: RUN npm ci --silent - Result: exit code 1 from npm ci - Warning: 1 warning found: FromAsCasing: 'as' and 'FROM' keywords casing do not match (Dockerfile:19) - The error trace shows: [build 5/7] RUN npm ci --silent failed during build - Immediate implications: - The failure occurs at the npm ci step, likely due to workspace/monorepo configuration or lockfile issues. - Suggested next steps: - Add/adjust .dockerignore to exclude node_modules and other nonessential files. - If using a monorepo, run npm ci with workspaces support or add a defined build script to install all packages. - Verify package-lock.json consistency and workspace configuration. - Confirm CRA/build outputs are directed to /app/build; consider adding a validation step in the final image. - Ensure that the serve binary is present in the final image, and adjust Dockerfile accordingly if needed.
# syntax=docker/dockerfile:1
FROM node:18-bullseye-slim AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates build-essential python3 git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies for the monorepo
COPY package.json package-lock.json lerna.json ./
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build the project (produces a static build for the CRA app)
RUN npm run build
# Runtime stage - serve with nginx
FROM nginx:alpine AS runtime
# Copy built static assets
COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html
# Configure nginx for single-page app routing
RUN mkdir -p /etc/nginx/conf.d
RUN bash -lc 'cat > /etc/nginx/conf.d/default.conf << "EOF"
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
EOF'
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
# Docker build ignore .git .gitignore node_modules **/node_modules **/build **/dist **/coverage .env *.log npm-debug.log* yarn-error.log* *.md~ *.tmp .vscode .idea .DS_Store .npmrc cache *.tgz pnpm-lock.yaml pnpm-workspace.yaml
Concerns: The runtime stage uses bash -lc to create the nginx config, but nginx:alpine does not include bash by default. This will fail during build/run. Use /bin/sh -lc or a portable approach (e.g., here-doc with sh, or COPY a pre-made config file).
# syntax=docker/dockerfile:1
FROM node:18-bullseye-slim AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates build-essential python3 git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies for the monorepo
COPY package.json package-lock.json lerna.json ./
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build the project (produces a static build for the CRA app)
RUN npm run build
# Runtime stage - serve with nginx
FROM nginx:alpine AS runtime
# Copy built static assets
COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html
# Configure nginx for single-page app routing
RUN mkdir -p /etc/nginx/conf.d
RUN /bin/sh -lc 'cat > /etc/nginx/conf.d/default.conf << "EOF"
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
EOF'
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:
#1 transferring dockerfile: 1.04kB done
#1 DONE 1.5s
#2 resolve image config for docker-image://docker.io/docker/dockerfile:1
#2 DONE 1.0s
#3 docker-image://docker.io/docker/dockerfile:1@sha256:4a43a54dd1fedceb30ba47e76cfcf2b47304f4161c0caeac2db1c61804ea3c91
#3 resolve docker.io/docker/dockerfile:1@sha256:4a43a54dd1fedceb30ba47e76cfcf2b47304f4161c0caeac2db1c61804ea3c91 0.1s done
#3 CACHED
Dockerfile:30
--------------------
28 | RUN mkdir -p /etc/nginx/conf.d
29 | RUN /bin/sh -lc 'cat > /etc/nginx/conf.d/default.conf << "EOF"
30 | >>> server {
31 | listen 80;
32 | server_name localhost;
--------------------
ERROR: failed to build: failed to solve: dockerfile parse error on line 30: unknown instruction: serverserver {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
# syntax=docker/dockerfile:1 FROM node:18-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Install dependencies for the monorepo COPY package.json package-lock.json lerna.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN npm run build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Summary (under 1500 chars):
- Failing step: [builder 5/7] RUN npm ci
- Exact error message and exit code:
- No workspaces found:
- --workspace=react-error-overlay
- A complete log of this run can be found in: /root/.npm/_logs/2026-03-23T19_14_04_377Z-debug-0.log
- code 1
- path /app
- command failed
- command sh -c npm run build:prod -w react-error-overlay
- Missing packages or files mentioned:
- The workspace react-error-overlay is not found in the npm workspaces configuration (No workspaces found: --workspace=react-error-overlay)
- Any version mismatch info:
- New major version of npm available! 10.8.2 -> 11.12.0# syntax=docker/dockerfile:1 FROM node:18-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Install dependencies for the monorepo COPY package.json package-lock.json lerna.json ./ # Ignore scripts to avoid postinstall/workspace-related issues in the container CI RUN npm ci --ignore-scripts # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN npm run build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Summary: - Failing command/step: - [builder 7/7] RUN npm run build - Docker exit: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 - Exact error message and exit code: - Error: Cannot find module 'react-dev-utils/crossSpawn' - code: 'MODULE_NOT_FOUND' - Exit code shown in log: 1 - Missing packages or files mentioned: - Missing module: react-dev-utils/crossSpawn - Require stack: /app/packages/react-scripts/bin/react-scripts.js - Node.js v18.20.8 - Version/mismatch information: - Node.js version: v18.20.8 - Runtime image/node base: node:18-bullseye-slim - npm major version available notice: 10.8.2 -> 11.12.0 - No explicit version mismatch of dependencies shown beyond the missing module error - Context: - The build reaches the CRA build step (npm run build) in the builder stage, but fails when react-scripts tries to require react-dev-utils/crossSpawn during the build process. Notes / potential next steps (concise): - Ensure react-dev-utils is installed and compatible with the react-scripts version in use. - Re-run npm ci or npm install to restore dependencies, ensuring lockfile consistency. - Check for discrepancies between react-scripts version and its transitive dependencies. - Consider updating npm version in the build image if relevant to dependency resolution.
# syntax=docker/dockerfile:1 FROM node:18-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* # Enable corepack for Yarn/PNPM RUN corepack enable WORKDIR /app # Install dependencies for the monorepo using Yarn (no yarn.lock is required here) COPY package.json lerna.json ./ RUN yarn install # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN yarn build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config (for SPA routing) COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
- Failing step: [builder 6/8] RUN yarn install (Dockerfile: line with RUN yarn install) - Exact error message and exit code: - 28.14 error lru-cache@11.2.7: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.20.8" - 28.15 error Found incompatible module. - Exit: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1 - Failing command/step details: - yarn install failed during the monorepo dependency install phase. - Missing packages or files mentioned: - No lockfile found (info No lockfile found.) — implies there was no yarn.lock present when running yarn install. - Version mismatch info: - Node version in the build: 18 (the base image is node:18-bullseye-slim) - Incompatible module: lru-cache@11.2.7 requires Node 20 or >=22 - Result: Node 18 installed in the image cannot satisfy the engine requirement of lru-cache@11.2.7 - Context to fix: - Use a Node version >=20 (e.g., FROM node:20-slim or node:22-slim) or adjust dependencies to be compatible with Node 18. - Consider adding a yarn.lock to ensure consistent installs if appropriate.
# syntax=docker/dockerfile:1 FROM node:20-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* # Runtime config - enable corepack for Yarn/PNPM RUN corepack enable WORKDIR /app # Install dependencies for the monorepo using Yarn (lockfile should be present in repo) COPY package.json yarn.lock lerna.json ./ RUN yarn install --frozen-lockfile # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN yarn build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config (for SPA routing) COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Summary of Docker build error - Exact error message and exit code: - Error: ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::qpwv2ics5xhpay554m9q7hiig: "/yarn.lock": not found - Exit code: not shown in the snippet - Failing command/step: - [builder 5/8] COPY package.json yarn.lock lerna.json ./ - Missing packages or files mentioned: - yarn.lock not found - Note: A warning indicates yarn.lock is excluded by .dockerignore (CopyIgnoredFile: Attempting to Copy file "yarn.lock" that is excluded by .dockerignore (line 15)) - Version mismatch info: - None provided.
No matches found.
{
"private": true,
"workspaces": [
"packages/*",
"docusaurus/website"
],
"scripts": {
"build": "cd packages/react-scripts && node bin/react-scripts.js build",
"changelog": "lerna-changelog",
"create-react-app": "node tasks/cra.js",
"e2e": "tasks/e2e-simple.sh",
"e2e:docker": "tasks/local-test.sh",
"postinstall": "npm run build:prod -w react-error-overlay",
"publish": "tasks/publish.sh",
"start": "cd packages/react-scripts && node bin/react-scripts.js start",
"screencast": "node ./tasks/screencast.js",
"screencast:error": "svg-term --cast jyu19xGl88FQ3poMY8Hbmfw8y --out screencast-error.svg --window --at 12000 --no-cursor",
"alex": "alex .",
"test:integration": "jest test/integration",
"test": "cd packages/react-scripts && node bin/react-scripts.js test",
"eslint": "eslint .",
"prettier": "prettier .",
"format": "npm run prettier -- --write"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"alex": "^8.2.0",
"eslint": "^8.3.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
"get-port": "^5.1.1",
"globby": "^11.0.4",
"husky": "^4.3.8",
"jest": "^27.4.3",
"lerna": "^4.0.0",
"lerna-changelog": "^2.2.0",
"lint-staged": "^12.1.2",
"meow": "^9.0.0",
"multimatch": "^5.0.0",
"prettier": "^2.5.0",
"puppeteer": "^12.0.1",
"strip-ansi": "^6.0.1",
"svg-term-cli": "^2.1.1",
"tempy": "^1.0.1",
"wait-for-localhost": "^3.3.0",
"web-vitals": "^2.1.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,json,yml,yaml,css,scss,ts,tsx,md}": [
"prettier --write"
]
}
}
# syntax=docker/dockerfile:1 FROM node:20-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* # Enable corepack for Yarn (if desired) RUN corepack enable WORKDIR /app # Copy only package management files first to leverage caching COPY package.json lerna.json ./ # Install dependencies for the monorepo using Yarn (no yarn.lock required yet) RUN yarn install # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN yarn build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config (for SPA routing) COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Summary (under 1500 chars): Error and exit code: - No workspaces found: --workspace=react-error-overlay - Command failed with exit code 1. Failing command/step: - During builder step 6/8: RUN yarn install - Specifically the nested command that failed: npm run build:prod -w react-error-overlay Exact error text preserved: - No workspaces found: --workspace=react-error-overlay - A complete log of this run can be found in: /root/.npm/_logs/2026-03-23T19_20_57_861Z-debug-0.log - error Command failed with exit code 1. Missing packages or files mentioned: - The monorepo is missing the react-error-overlay workspace (the workspace named react-error-overlay does not exist in the configured workspaces). Version mismatch information: - None reported in this error. The failure is due to a missing workspace, not a version mismatch.
# syntax=docker/dockerfile:1 FROM node:20-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git curl unzip && \ rm -rf /var/lib/apt/lists/* # Enable corepack for Yarn RUN corepack enable WORKDIR /app # Copy only package management files first to leverage caching COPY package.json lerna.json ./ # Install dependencies for the monorepo using Yarn RUN yarn install --frozen-lockfile || true # Copy the rest of the source code COPY . . # Build the project (produces a static build for the CRA app) RUN yarn build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config (for SPA routing) COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
- Failing command/step:
- [builder 8/8] RUN yarn build
- Exact error message and exit code:
- Error: Cannot find module 'react-dev-utils/crossSpawn'
- Node.js v20.20.1
- code: 'MODULE_NOT_FOUND'
- Require stack: /app/packages/react-scripts/bin/react-scripts.js
- Exit code: 1
- Missing packages or files mentioned:
- Missing module: react-dev-utils/crossSpawn (Cannot find module)
- Version mismatch / environment info:
- Node.js version: v20.20.1
- Yarn version: 1.22.22
- Base image for builder uses Node 20 (node:20-bullseye-slim)
- Prior related step (context): earlier step attempted yarn install and a separate npm/yarn build attempt failed with No workspaces found for react-error-overlay:
- npm error No workspaces found: --workspace=react-error-overlay
- Additional context (from the log):
- The failure occurs during the CRA build via react-scripts, suggesting a missing or incompatible react-dev-utils dependency in this Node/Yarn/CRA combo.# syntax=docker/dockerfile:1 FROM node:18-bullseye-slim AS builder # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates build-essential python3 git && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Install top-level dependencies first to leverage caching COPY package.json package-lock.json lerna.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build the project RUN npm run build # Runtime stage - serve with nginx FROM nginx:alpine AS runtime # Copy built static assets COPY --from=builder /app/packages/react-scripts/build /usr/share/nginx/html # Copy pre-defined nginx config (for SPA routing) COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Concerns: Build output path must match '/app/packages/react-scripts/build'. If the build script outputs to a different directory, COPY won't package the assets., Ensure nginx/default.conf exists in the repo; missing file will cause docker build to fail.