-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use the official Node.js image as the base image | ||
FROM node:lts-alpine as build | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY client/package.json client/package-lock.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the client application files | ||
COPY client/ ./ | ||
|
||
# Build the React app | ||
RUN npm run build | ||
|
||
# Use a lightweight Nginx server as the production server | ||
FROM nginx:1.21.4-alpine | ||
|
||
# Copy the built React app to the Nginx server directory | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
|
||
# Expose port 80 for web traffic | ||
EXPOSE 80 | ||
|
||
# Start Nginx | ||
CMD ["nginx", "-g", "daemon off;"] |