-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
29 lines (20 loc) · 704 Bytes
/
Dockerfile.frontend
File metadata and controls
29 lines (20 loc) · 704 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
# Use the official Node.js image as the base image
FROM node:16-alpine
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY ./frontend/package*.json ./
# Install the dependencies
RUN npm install
# Copy the rest of the application code to the working directory
COPY ./frontend .
# Build the React application
RUN npm run build
# Use the official Nginx image to serve the React application
FROM nginx:alpine
# Copy the built React application from the previous stage
COPY --from=0 /app/build /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Start Nginx when the container starts
CMD ["nginx", "-g", "daemon off;"]