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
1 parent
e78520e
commit 4fbc9a6
Showing
4 changed files
with
83 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 @@ | ||
node_modules |
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
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,46 @@ | ||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
root /var/www; | ||
|
||
#add_header X-Frame-Options "SAMEORIGIN"; | ||
#add_header X-Content-Type-Options "nosniff"; | ||
|
||
index index.html; | ||
|
||
charset utf-8; | ||
|
||
# _ makes sure that nginx does not try to map requests to a specific hostname | ||
# This allows us to specify the urls to our application as infrastructure changes, | ||
# without needing to change the application | ||
server_name _; | ||
|
||
error_log /var/log/nginx/error.log; | ||
access_log /var/log/nginx/access.log; | ||
|
||
# Some static assets are loaded on every page load, | ||
# and logging these turns into a lot of useless logs. | ||
# If you would prefer to see these requests for catching 404's etc. | ||
# Feel free to remove them | ||
location = /favicon.ico { access_log off; log_not_found off; } | ||
location = /robots.txt { access_log off; log_not_found off; } | ||
|
||
# When a 404 is returned, we want to display our applications 404 page, | ||
# so we redirect it to index.php to load the correct page | ||
error_page 404 /index.php; | ||
|
||
location / { | ||
add_header Access-Control-Allow-Origin *; | ||
|
||
try_files $uri /index.html; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
|
||
location ~ /\.(?!well-known).* { | ||
deny all; | ||
} | ||
} |