Update Dockerfile
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,10 +1,10 @@
|
|||||||
# Stage 1: Build the React Application
|
# Stage 1: Build the React Application
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-slim AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package.json to install dependencies first (better caching)
|
# Copy package.json (and lock file if it exists) to install dependencies first
|
||||||
COPY package.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install all dependencies (including devDependencies for the build process)
|
# Install all dependencies (including devDependencies for the build process)
|
||||||
RUN npm install
|
RUN npm install
|
||||||
@@ -16,12 +16,12 @@ COPY . .
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 2: Setup the Production Server (Node.js)
|
# Stage 2: Setup the Production Server (Node.js)
|
||||||
FROM node:20-alpine
|
FROM node:20-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package.json again for production dependencies
|
# Copy package.json again for production dependencies
|
||||||
COPY package.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install ONLY production dependencies (skips devDependencies like Vite/Typescript)
|
# Install ONLY production dependencies (skips devDependencies like Vite/Typescript)
|
||||||
RUN npm install --omit=dev
|
RUN npm install --omit=dev
|
||||||
|
|||||||
Reference in New Issue
Block a user