fix: use npm install and explicit package-lock.json COPY in sync Dockerfile

Avoids stale Docker layer cache issue where tsc was not found because
an old npm ci layer (without dev deps) was cached on the build host.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Hochmeister
2026-03-01 13:33:42 +01:00
parent e6c2a01b8a
commit dee27200ce

View File

@@ -1,8 +1,8 @@
# Stage 1: build TypeScript + install all deps # Stage 1: build TypeScript + install all deps
FROM node:20-slim AS builder FROM node:20-slim AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package.json package-lock.json ./
RUN npm ci --include=dev RUN npm install
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY src ./src COPY src ./src
RUN ./node_modules/.bin/tsc && npm prune --production RUN ./node_modules/.bin/tsc && npm prune --production
@@ -15,3 +15,4 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]