From 00d893a86e9ffb61d46cd88ef0d6d26767790dad Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 15 Jun 2026 19:32:34 +0530 Subject: [PATCH] udpates on the dockerfile --- Dockerfile | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06927f0..c808df1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,33 @@ +# Stage 1: Build the React application +FROM node:22-alpine AS builder + +WORKDIR /app + +# Copy package.json and lockfile +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of your application code +COPY . . + +# Build the Vite application (this creates the /app/dist folder inside the container) +RUN npm run build + +# Stage 2: Serve the application with Nginx FROM nginx:alpine # Move to Nginx's public folder WORKDIR /usr/share/nginx/html -# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely +# 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 dist/ . +# Copy the compiled static assets FROM THE BUILDER STAGE +COPY --from=builder /app/dist/ . -# 3. Copy your custom Nginx configuration (which you already have in your log) +# Copy your custom Nginx configuration COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80