FROM node:18-slim WORKDIR /usr/src/app # Install dependencies from package.json (no package-lock.json, npm install will install latest compatible) COPY package.json ./ RUN npm install # Copy the rest of the source code COPY . . # Optional build step if a build script exists; ignore errors to keep image usable for a library RUN npm run build || true # Note: No default CMD to keep this as a library image; consumers should provide their own command.