# Multi-stage build für minimales Image

# Build Stage
FROM node:18-alpine AS builder

WORKDIR /app

# Kopiere package files
COPY package*.json ./
COPY bun.lockb* ./

# Installiere Dependencies
RUN npm ci --only=production=false

# Kopiere Source Code
COPY . .

# Build der Anwendung
RUN npm run build

# Production Stage
FROM nginx:alpine

# Kopiere Build-Artefakte vom Builder
COPY --from=builder /app/dist /usr/share/nginx/html

# Kopiere nginx Konfiguration
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Exponiere Port 80
EXPOSE 80

# nginx läuft automatisch im Vordergrund
CMD ["nginx", "-g", "daemon off;"]
