dockerize
This commit is contained in:
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
# Stage 1: Build
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
# Dependencies installieren (Caching nutzen)
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
# Code kopieren und bauen (kopiert dank nest-cli.json auch die .hbs/.assets)
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production Run
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
# Nur Production-Dependencies installieren (hält das Image extrem klein!)
|
||||
COPY package*.json ./
|
||||
RUN npm install --omit=dev
|
||||
# Kompilierten Code aus Stage 1 übernehmen
|
||||
COPY --from=build /app/dist ./dist
|
||||
|
||||
# NestJS Standard-Port
|
||||
EXPOSE 3000
|
||||
CMD ["node", "dist/main"]
|
||||
Reference in New Issue
Block a user