-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 787 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (22 loc) · 787 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
# Use an official Node runtime as the base image
FROM node:lts-alpine as build-stage
# Set the working directory in the container to /app
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install the application dependencies
RUN npm install
# Copy the rest of the application code to the working directory
COPY . .
# Build the application for production
RUN npm run build
# Start a new stage for the production environment
FROM nginx:stable-alpine as production-stage
# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the built app to the nginx server
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]