29 lines
486 B
Docker
29 lines
486 B
Docker
# 1. Build-Stage
|
|
FROM node:18-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# package files kopieren
|
|
COPY package*.json ./
|
|
|
|
# dependencies installieren
|
|
RUN npm install
|
|
|
|
# restlichen Code kopieren
|
|
COPY . .
|
|
|
|
# React App bauen
|
|
RUN npm run build
|
|
|
|
# 2. Serve-Stage (Nginx)
|
|
FROM nginx:alpine
|
|
|
|
# build output in nginx kopieren
|
|
COPY --from=build /app/build /usr/share/nginx/html
|
|
|
|
# optional: eigene nginx config
|
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 5173
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |