-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 785 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Multi-stage build for production optimization
# Stage 1: Build the React application
FROM node:22-alpine AS builder
# Set the working directory in the container
WORKDIR /app
# Copy package files for dependency installation
COPY package*.json ./
# Install all dependencies (including devDependencies needed for build)
RUN npm ci --silent
# Copy source code
COPY . .
# Build the React application for production
RUN npm run build
# Stage 2: Serve with nginx
FROM nginx:alpine
# Copy built application from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy custom nginx configuration for better performance
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80 for web traffic
EXPOSE 80
# Start nginx server
CMD ["nginx", "-g", "daemon off;"]