-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (20 loc) · 703 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (20 loc) · 703 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
# Stage 1: Build the React application
FROM node:20-alpine AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the dependency definitions
COPY package.json ./
# Install project dependencies
RUN npm install
# Copy the rest of the application files
COPY . .
# Build the production bundle (generates files in /app/dist)
RUN npm run build
# Stage 2: Serve the static files using Nginx
FROM nginx:alpine
# Copy custom built assets from builder stage into Nginx html directory
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port 80 (default Nginx port)
EXPOSE 80
# Run Nginx in the foreground so the container stays active
CMD ["nginx", "-g", "daemon off;"]