updates on the build

This commit is contained in:
2026-07-07 19:05:11 +05:30
parent 9dea202ddb
commit f77d87ccf5

View File

@@ -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 WORKDIR /usr/share/nginx/html
# 1. CRUCIAL: Remove Nginx's default "Welcome" page files completely # Clean default Nginx files
RUN rm -rf ./* RUN rm -rf ./*
# 2. Copy your compiled static assets into the root folder. # Copy built assets from Stage 1 (Vite default output is "dist")
# NOTE: If your folder is named "dist" instead of "build", change "build/" to "dist/" COPY --from=build-stage /app/dist .
COPY build/ .
# 3. Copy your custom Nginx configuration (which you already have in your log) # Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]