Files
LA2NodeJS/Dockerfile.react
2026-04-25 09:58:43 +02:00

34 lines
638 B
React

# Stage 1: Build React app
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY react-client/package.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY react-client/src ./src
COPY react-client/public ./public
COPY react-client/vite.config.ts ./
COPY react-client/tsconfig.json ./
COPY react-client/index.html ./
# Build the app
RUN npm run build
# Stage 2: Production
FROM nginx:alpine AS production
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]