From 9dea202ddb4b54d3b4b0040dbefff491e7de1eeb Mon Sep 17 00:00:00 2001 From: dharaneesh-r Date: Tue, 7 Jul 2026 18:54:03 +0530 Subject: [PATCH 1/3] updates on the dockerfile and the nginx file --- Dockerfile | 18 ++++++++++++++++++ nginx.conf | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d04ccdf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM nginx:alpine + +# Move to Nginx's public folder +WORKDIR /usr/share/nginx/html + +# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely +RUN rm -rf ./* + +# 2. Copy your compiled static assets into the root folder. +# NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/" +COPY build/ . + +# 3. Copy your custom Nginx configuration (which you already have in your log) +COPY nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f1a121b --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +events {} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + # This line forces Nginx to pass routing back to React Router + try_files $uri $uri/ /index.html; + } + } +} From f77d87ccf5334e965d0188a8221a3fb22aaf8dcd Mon Sep 17 00:00:00 2001 From: dharaneesh-r Date: Tue, 7 Jul 2026 19:05:11 +0530 Subject: [PATCH 2/3] updates on the build --- Dockerfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d04ccdf..b764f4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,29 @@ -FROM nginx:alpine +# --- Step 1: Build the React Application --- +FROM node:20-alpine AS build-stage +WORKDIR /app -# Move to Nginx's public folder +# Install dependencies +COPY package.json package-lock.json ./ +RUN npm ci + +# Copy source files and build +COPY . . +RUN npm run build + +# --- Step 2: Serve the Built Assets via Nginx --- +FROM nginx:alpine WORKDIR /usr/share/nginx/html -# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely +# Clean default Nginx files RUN rm -rf ./* -# 2. Copy your compiled static assets into the root folder. -# NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/" -COPY build/ . +# Copy built assets from Stage 1 (Vite default output is "dist") +COPY --from=build-stage /app/dist . -# 3. Copy your custom Nginx configuration (which you already have in your log) +# Copy custom Nginx configuration COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] + From 33b2c96a5bec1861cd1b3b7ebdaf39d417a19b7b Mon Sep 17 00:00:00 2001 From: dharaneesh-r Date: Tue, 7 Jul 2026 19:09:08 +0530 Subject: [PATCH 3/3] updates onthe b uild --- Dockerfile | 2 +- nginx.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b764f4c..df108a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ COPY --from=build-stage /app/dist . # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/nginx.conf -EXPOSE 80 +EXPOSE 3000 CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf index f1a121b..2d1953f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,7 +5,7 @@ http { default_type application/octet-stream; server { - listen 80; + listen 3000; server_name localhost; location / {