FROM node:slim # Create app directory WORKDIR /usr/src/app # Install dependencies first (copy package manifests separately for caching) COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build from source RUN npm run build # Default command: drop into a shell (library container; no runtime server) CMD ["bash"]
# Node modules and build output node_modules/ dist/ build/ coverage/ tests/ tests2/ # Logs npm-debug.log* yarn-debug.log* yarn-error.log* *.log # OS .DS_Store # Dependency management package-lock.json pnpm-lock.yaml # IDEs .vscode/ .idea/ # Git .git/ .node_repl_history .env
Summary (under 1500 chars): - Exact error message and exit code - ERROR: failed to calculate checksum of ref uxa8fufxvbao3ljpfj20tpl2j::tafa2h7t9qcbu6gxhqk7jyz2k: "/package-lock.json": not found - Exit code: non-zero (build failed) - Failing command/step - [3/6] COPY package.json package-lock.json ./: - Missing packages or files mentioned - /package-lock.json: not found - package-lock.json is excluded by .dockerignore (line 7) - Version mismatch information - Base image: node:slim (digest sha256:44bcbf493408a824104e74976ae5539f596c46cbe75ed0423a137552a555e2de) - No explicit version mismatch detected; error is due to missing package-lock.json being excluded by .dockerignore, not a version conflict.
# Node modules and build output node_modules/ dist/ build/ coverage/ tests/ tests2/ # Logs npm-debug.log* yarn-debug.log* yarn-error.log* *.log # OS .DS_Store # Dependency management pnpm-lock.yaml # IDEs .vscode/ .idea/ # Git .git/ .node_repl_history .env
FROM node:slim # Create app directory WORKDIR /usr/src/app # Install dependencies first (copy package manifests separately for caching) COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the source code COPY . . # Build from source RUN npm run build # Default command: drop into a shell (library container; no runtime server) CMD ["bash"]
Smoke [FAIL]: node -e \"console.log('name:' + require('./package.json').name)\
Output: sh: 1: Syntax error: "(" unexpected
Smoke [FAIL]: node -e \"console.log('version:' + require('./package.json').version)\
Output: sh: 1: Syntax error: "(" unexpected
Smoke [FAIL]: sh -c \"if [ -d dist ]; then echo dist-ok; elif [ -d lib ]; then echo lib-ok; else echo no-build-artifacts; exit 1; fi\
Output: sh: 1: Syntax error: "then" unexpectedConcerns: No explicit runtime server; this is a library container intended to build from source, which is acceptable but may be surprising for users expecting a runnable app, CMD is set to launch a shell (bash), which is fine for a library container but may be inconvenient for downstream consumers expecting a ready-to-run artifact Smoke [PASS]: node -v && npm -v Smoke [PASS]: if [ -d build ]; then echo 'build directory exists'; elif [ -d dist ]; then echo 'dist directory exists'; else echo 'no build output'; exit 1; fi