# Multi-Stage Build für Frontend # Stage 1: Build FROM node:18-alpine AS builder WORKDIR /app # Package files kopieren COPY package*.json ./ # Dependencies installieren RUN npm install --legacy-peer-deps # Source Code kopieren COPY . . # React App bauen RUN npm run build # Stage 2: Production mit nginx FROM nginx:alpine # Gebaute App von Builder-Stage kopieren COPY --from=builder /app/build /usr/share/nginx/html # nginx Konfiguration kopieren COPY nginx.conf /etc/nginx/conf.d/default.conf # SSL-Zertifikat einbinden COPY ssl/cert.crt /etc/nginx/ssl/cert.crt COPY ssl/cert.key /etc/nginx/ssl/cert.key # Ports freigeben EXPOSE 80 EXPOSE 443 # nginx starten CMD ["nginx", "-g", "daemon off;"]