32 lines
574 B
Docker
32 lines
574 B
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies (if needed)
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build React app
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:1.25-alpine
|
|
|
|
# Copy nginx config
|
|
COPY docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy build artifacts
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
|
|
# Expose and run
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"] |