-
Notifications
You must be signed in to change notification settings - Fork 140
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
2 changed files
with
5 additions
and
23 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
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 |
---|---|---|
@@ -1,27 +1,9 @@ | ||
# Stage 1: Build the react app | ||
FROM node:18 AS build | ||
FROM node:20-alpine as build | ||
|
||
WORKDIR /usr/src/app | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to install dependencies | ||
COPY package*.json ./ | ||
RUN npm install yarn --global --force | ||
|
||
# Install dependencies with legacy peer deps option | ||
RUN npm install --legacy-peer-deps || true | ||
|
||
# Copy the rest of the application source code | ||
COPY . . | ||
|
||
# Build the app (if there are build commands in the package.json) | ||
RUN npm run build | ||
|
||
# Stage 2: Serve the built app using nginx | ||
FROM nginx:alpine | ||
|
||
# Copy the built files from the previous stage to the nginx container | ||
COPY --from=build /usr/src/app/build /usr/share/nginx/html | ||
|
||
# Expose the port Nginx will listen to | ||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
RUN yarn install && yarn build |