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:
@@ -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"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user