# syntax=docker/dockerfile:1
FROM node:24-slim AS builder
WORKDIR /app
# Install dependencies needed to build the project (including devDependencies)
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build from source
COPY . .
RUN npm run build
# Final runtime image
FROM node:24-slim
WORKDIR /app
# Copy built artifacts from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/index.js ./index.js
# Copy package manifests and install production dependencies only
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN npm ci --production
# Verify at container startup that the library is loadable
CMD ["node", "-e", "require('./dist/node/axios.cjs'); console.log('Axios module loaded in container');"]
# Ignore node_modules and build outputs node_modules/ dist/ .env .git .gitignore Dockerfile .dockerignore npm-debug.log package-lock.json
Summary (under 1500 chars): - Exact error message and exit code: - Error: sh: 1: husky: not found - Exit code: 127 (npm error code 127) - npm reported: command failed and npm error path: command sh -c husky - Failing command/step: - [stage-1 7/7] RUN npm ci --production (Dockerfile line 30) - Missing packages or files mentioned: - husky not found. The axios@1.13.6 prepare step runs husky, but husky is not installed in production mode. - Version mismatch/info: - axios version: 1.13.6 - Node base image: node:24-slim - npm version shown in logs: 11.9.0 (with note about available npm 11.12.0) - Additional context: Running npm ci --production caused dev/deps scripts (prepare) to execute, failing because husky isn’t installed in production install.
# syntax=docker/dockerfile:1
FROM node:24-slim AS builder
WORKDIR /app
# Install dependencies needed to build the project (including devDependencies)
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build from source
COPY . .
RUN npm run build
# Final runtime image
FROM node:24-slim
WORKDIR /app
# Copy built artifacts from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/index.js ./index.js
# Copy package manifests and install production dependencies only, skipping scripts (e.g., husky)
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN npm ci --production --ignore-scripts
# Basic startup command to verify that the module loads
CMD ["node", "-e", "require('./dist/node/axios.cjs'); console.log('Axios module loaded in container');"]
Smoke [FAIL]: node -e "try { require('./dist/node/axios.cjs'); console.log('Axios module loaded in container'); } catch (e) { console.error(e); process.exit(1); }
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [PASS]: test -f dist/node/axios.cjs && echo 'Found dist/node/axios.cjs' || (echo 'Missing dist/node/axios.cjs' && exit 1)
Smoke [PASS]: node -v# syntax=docker/dockerfile:1
FROM node:24-slim AS builder
WORKDIR /app
# Install dependencies needed to build the project (including devDependencies)
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build from source
COPY . .
RUN npm run build
# Create a small verify script to ensure the library loads at runtime without shell quoting issues
RUN bash -lc 'printf "try { require(\\"./dist/node/axios.cjs\\"); console.log(\\"Axios module loaded in container\\"); } catch (e) { console.error(e); process.exit(1); }" > /app/verify.js'
# Final runtime image
FROM node:24-slim
WORKDIR /app
# Copy built artifacts from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/verify.js ./verify.js
# Copy package manifests and install production dependencies only, skipping scripts (e.g., husky)
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN npm ci --production --ignore-scripts
# Run the verify script at startup to ensure the module loads correctly
CMD ["node", "/app/verify.js"]
Smoke [FAIL]: node -e 'try { require("./dist/node/axios.cjs"); console.log("Axios module loaded in container"); } catch (e) { console.error(e); process.exit(1); }
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: node /app/verify.js
Output: file:///app/verify.js:1
try { require(\./dist/node/axios.cjs\); console.log(\Axios
^
SyntaxError: Invalid or unexpected token
at compileSourceTextModule (node:internal/modules/esm/utils:318:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:99:18)
at #translate (node:internal/modules/esm/loader:473:20)
at afterLoad (node:internal/modules/esm/loader:529:29)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:534:12)
at ## syntax=docker/dockerfile:1
FROM node:24-slim AS builder
WORKDIR /app
# Install dependencies needed to build the project (including devDependencies)
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build from source
COPY . .
RUN npm run build
# Final runtime image
FROM node:24-slim
WORKDIR /app
# Copy built artifacts from builder stage
COPY --from=builder /app/dist ./dist
# Copy package manifests and install production dependencies only, skipping scripts (e.g., husky)
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN npm ci --production --ignore-scripts
# Verify that the Axios package can be loaded when the container starts
CMD ["node", "-e", "require('./dist/node/axios.cjs'); console.log('Axios module loaded in container');"]
Smoke [PASS]: test -f ./dist/node/axios.cjs && echo 'dist file exists' || (echo 'dist file missing'; exit 1)
Smoke [FAIL]: node -e "require('./dist/node/axios.cjs'); console.log('Axios module loaded in container');
Output: sh: 1: Syntax error: Unterminated quoted string# syntax=docker/dockerfile:1
FROM node:24-slim AS builder
WORKDIR /app
# Install dependencies needed to build the project (including devDependencies)
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source and build from source
COPY . .
RUN npm run build
# Create a small verify script to ensure the library loads at runtime
RUN bash -lc 'cat > /app/run_verify.js << "JS"
try {
require("./dist/node/axios.cjs");
console.log("Axios loaded");
} catch (e) {
console.error(e);
process.exit(1);
}
JS'
# Final runtime image
FROM node:24-slim
WORKDIR /app
# Copy built artifacts from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/run_verify.js ./run_verify.js
# Copy package manifests and install production dependencies only, skipping scripts (e.g., husky)
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
RUN npm ci --production --ignore-scripts
# Run the verify script at startup to ensure the module loads correctly
CMD ["node", "/app/run_verify.js"]
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.13kB done
#1 DONE 0.0s
#2 resolve image config for docker-image://docker.io/docker/dockerfile:1
#2 DONE 0.5s
#3 docker-image://docker.io/docker/dockerfile:1@sha256:4a43a54dd1fedceb30ba47e76cfcf2b47304f4161c0caeac2db1c61804ea3c91
#3 resolve docker.io/docker/dockerfile:1@sha256:4a43a54dd1fedceb30ba47e76cfcf2b47304f4161c0caeac2db1c61804ea3c91 0.0s done
#3 CACHED
Dockerfile:19
--------------------
17 | # Create a small verify script to ensure the library loads at runtime
18 | RUN bash -lc 'cat > /app/run_verify.js << "JS"
19 | >>> try {
20 | require("./dist/node/axios.cjs");
21 | console.log("Axios loaded");
--------------------
ERROR: failed to build: failed to solve: dockerfile parse error on line 19: unknown instruction: try (did you mean arg?)try {
require('./dist/node/axios.cjs');
console.log('Axios loaded');
} catch (e) {
console.error(e);
process.exit(1);
}
# syntax=docker/dockerfile:1 FROM node:24-slim AS builder WORKDIR /app # Install dependencies needed to build the project (including devDependencies) COPY package.json package-lock.json ./ RUN npm ci # Copy the rest of the source and build from source COPY . . RUN npm run build # Final runtime image FROM node:24-slim WORKDIR /app # Copy built artifacts from builder stage COPY --from=builder /app/dist ./dist # Copy package manifests and install production dependencies only, skipping scripts (e.g., husky) COPY --from=builder /app/package.json ./package.json COPY --from=builder /app/package-lock.json ./package-lock.json RUN npm ci --production --ignore-scripts # Copy verification script COPY ./scripts/verify-container.js ./verify-container.js # Run verification script at startup CMD ["node", "./verify-container.js"]
Concerns: Relies on scripts/verify-container.js existing at scripts/verify-container.js; if missing, the build may fail. Smoke [PASS]: test -d /app/dist Smoke [PASS]: test -f /app/package.json Smoke [PASS]: node -v