-
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.
feat: Dockerize application for production deployment
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 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,3 @@ | ||
node_modules | ||
build | ||
*.log |
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
# Use an official Node.js runtime as a parent image | ||
FROM node:18 AS build | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN yarn install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
ENV GENERATE_SOURCEMAP=false | ||
ENV NODE_OPTIONS="--max-old-space-size=2048" | ||
|
||
|
||
# Build the React application | ||
RUN yarn build | ||
|
||
# Use a smaller image to serve the application | ||
FROM nginx:alpine | ||
|
||
# Copy the built application from the build stage | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# Expose port 80 for the application | ||
EXPOSE 80 | ||
|
||
# Start Nginx server | ||
CMD ["nginx", "-g", "daemon off;"] |