forked from ed-roh/react-admin-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 725 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 725 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
34
35
36
37
38
# Use Node.js image to build the React app
FROM node:18-alpine AS build
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application
COPY . .
# Build the React app
RUN npm run build
# Use an Nginx image to serve the built files
FROM nginx:alpine
# Set working directory for Nginx
WORKDIR /usr/share/nginx/html
# Remove default Nginx static files
RUN rm -rf ./*
# Copy built files from previous stage
COPY --from=build /app/build ./
# Copy a custom Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 8080 for GCP
EXPOSE 8080
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]