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