1# --------------------
2# Build stage
3# --------------------
4FROM node:20-alpine AS build
5
6# Set working directory
7WORKDIR /app
8
9# Copy dependency files first (better caching)
10COPY package.json package-lock.json ./
11
12# Install dependencies
13RUN npm ci
14
15# Copy the rest of the source code
16COPY . .
17
18# Build the app
19RUN npm run build
20
21
22# --------------------
23# Production stage
24# --------------------
25FROM nginx:alpine
26
27# Copy built files from build stage
28COPY --from=build /app/dist /usr/share/nginx/html
29
30# Expose port 80
31EXPOSE 80
32
33# Start nginx
34CMD ["nginx", "-g", "daemon off;"]