28 lines
464 B
Docker
28 lines
464 B
Docker
# Stage 1: Build React App
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Dependencies installieren
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# App bauen
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve with nginx
|
|
FROM nginx:alpine
|
|
|
|
# nginx.conf kopieren
|
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Built app aus builder stage kopieren
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Port 80 exponieren
|
|
EXPOSE 80
|
|
|
|
# nginx starten
|
|
CMD ["nginx", "-g", "daemon off;"]
|