-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from arnab2001/dockerize
nginx docker prod
- Loading branch information
Showing
5 changed files
with
92 additions
and
10 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 | ||
npm-debug.log |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use the official Node.js runtime as the base image | ||
FROM node:18 as build | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the entire application code to the container | ||
COPY . . | ||
|
||
# Build the React app for production | ||
RUN npm run build | ||
|
||
# Use Nginx as the production server | ||
FROM nginx:alpine | ||
|
||
# Copy the built React app to Nginx's web server directory | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
|
||
# Expose port 80 for the Nginx server | ||
EXPOSE 80 | ||
|
||
# Start Nginx when the container runs | ||
CMD ["nginx", "-g", "daemon off;"] |
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 @@ | ||
http { | ||
|
||
include mime.types; | ||
|
||
set_real_ip_from 0.0.0.0/0; | ||
real_ip_recursive on; | ||
real_ip_header X-Forward-For; | ||
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s; | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
root /proxy; | ||
limit_req zone=mylimit burst=70 nodelay; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} | ||
|
||
events {} |
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ package-lock.json | |
/server/public | ||
# misc | ||
.DS_Store | ||
|
||
.env | ||
.env.local | ||
.env.development.local | ||
|