FROM node:lts LABEL maintainer="BuildAgent" # Build jCarousel from source inside the container WORKDIR /usr/src/app # Install dependencies first to take advantage of Docker cache COPY package.json package-lock.json ./ RUN npm install # Copy the rest of the source COPY . . # Build distribution artifacts RUN npm run dist # Keep the container running and expose a quick sanity check of the built artifacts CMD ["bash", "-lc", "node -v && echo 'jCarousel dist ready' && ls -la dist && tail -f /dev/null"]
# Node modules and build artifacts node_modules/ dist/ # Git and OS junk .git/ *.log .DS_Store # Tests and docs test/ docs/ Examples/ # Optional local env files .env
Failing step - [6/6] RUN npm run dist (Dockerfile: line 16). Exit code: 1. Exact error message - npm error Missing script: "dist" - To see a list of scripts, run: npm run - A complete log of this run can be found in: /root/.npm/_logs/2026-03-19T13_34_18_840Z-debug-0.log Summary of root cause - The build fails because package.json does not define a dist script, so npm run dist cannot execute. Version/compatibility notes - npm indicates the package-lock.json was created with an old version of npm. - A newer npm version is available: 11.12.0 (current 11.9.0). - (No explicit missing packages or files beyond the missing dist script were reported.)
FROM node:lts LABEL maintainer="BuildAgent" # Build jCarousel from source inside the container WORKDIR /usr/src/app # Install dependencies first to take advantage of Docker cache COPY package.json package-lock.json ./ RUN npm install # Copy the rest of the source COPY . . # Build distribution artifacts using local Grunt setup RUN ./node_modules/.bin/grunt dist # Keep container alive for inspection; production containers may replace this with a proper entrypoint CMD ["bash", "-lc", "node -v && echo 'Dist ready' && ls -la dist && tail -f /dev/null"]
Concerns: The FROM image uses a moving tag (node:lts) which can lead to non-deterministic builds; consider pinning to a specific Node version (e.g., node:18.x)., The build step relies on grunt being installed in node_modules; ensure npm install actually installs grunt and any build tool dependencies; consider adding a dedicated build stage or pinned tool versions. Also ensure .dockerignore excludes heavy files to avoid bloating the image.
Smoke [PASS]: node -v
Smoke [FAIL]: node -e 'console.log(require("./package.json").name)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: test -d dist && echo 'dist dir exists' || echo 'dist dir missing
Output: sh: 1: Syntax error: Unterminated quoted stringFROM node:18-bullseye-slim AS builder WORKDIR /work # Install dependencies COPY package.json package-lock.json ./ RUN npm install # Copy source and build COPY . . RUN ./node_modules/.bin/grunt dist FROM node:18-bullseye-slim AS runtime WORKDIR /work COPY --from=builder /work/dist ./dist CMD ["sh", "-lc", "echo 'jCarousel dist ready' && ls -la dist"]
Smoke [PASS]: test -d dist Smoke [PASS]: ls -la dist