updates on the build
This commit is contained in:
25
Dockerfile
25
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;"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user