neuer build

This commit is contained in:
2026-02-06 11:21:39 -06:00
parent 0b4e4207d1
commit ae12eb87f0
6 changed files with 113 additions and 74 deletions

View File

@@ -1,19 +1,25 @@
# Build Stage
FROM node:18-alpine AS build
# --- STAGE 1: Build ---
FROM node:22-alpine AS builder
WORKDIR /app
# HIER KEIN NODE_ENV=production setzen! Wir brauchen devDependencies zum Bauen.
COPY package*.json ./
RUN npm install
RUN npm ci
COPY . .
RUN npm run build
# Runtime Stage
FROM node:18-alpine
# --- STAGE 2: Runtime ---
FROM node:22-alpine
WORKDIR /app
COPY --from=build /app/dist /app/dist
COPY --from=build /app/package*.json /app/
RUN npm install --production
# HIER ist es richtig!
ENV NODE_ENV=production
CMD ["node", "dist/main.js"]
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package*.json /app/
# Installiert nur "dependencies" (Nest core, TypeORM, Helmet, Sharp etc.)
# "devDependencies" (TypeScript, Jest, ESLint) werden weggelassen.
RUN npm ci --omit=dev
# WICHTIG: Pfad prüfen (siehe Punkt 2 unten)
CMD ["node", "dist/src/main.js"]