-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.multi
32 lines (22 loc) · 712 Bytes
/
Dockerfile.multi
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
# Stage 1: Build the application
FROM node:21.6-alpine3.18 AS builder
# Set the working directory for the build stage
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the application source code into the container
COPY . .
# Build the application
RUN npm run build
# Stage 2: Create the final image
FROM nginx:1.20
# Set the working directory within the container
WORKDIR /app
# Copy the built application files from the builder stage to the nginx html directory
COPY --from=builder /app/build /usr/share/nginx/html
# Expose port 80 for the web server
EXPOSE 80
# Start nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]