demo-app/Dockerfile
Noah Holt f6a971b194
All checks were successful
/ checks (pull_request) Successful in 36s
fix: install production dependencies in runtime image
Express was added in 1365bd7 but the runtime stage still assumed zero
runtime deps, so the image crashed with ERR_MODULE_NOT_FOUND: express.
2026-11-05 00:56:45 -06:00

21 lines
472 B
Docker

# Build stage: full toolchain, compile TS -> dist/
FROM node:22 AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY tsconfig.json ./
COPY src ./src
RUN npm run build
# Runtime stage: production deps only
FROM node:22-slim
WORKDIR /app
ENV NODE_ENV=production
ARG GIT_SHA=dev
ENV GIT_SHA=${GIT_SHA}
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
USER node
EXPOSE 3000
CMD ["node", "dist/index.js"]