From 926eda7cb060d6c1c895aa97c46e1dba0e846dd7 Mon Sep 17 00:00:00 2001 From: Marc Emmanuel Date: Sun, 11 Jan 2026 21:08:37 +0100 Subject: [PATCH] fix: update Dockerfile to use multi-stage build for optimized production image --- Dockerfile | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d3d6005e..eb179d16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,26 @@ +# Build stage +FROM node:20-alpine AS builder + +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy source code +COPY ./src ./src +COPY vite.config.js . + +# Build the application +RUN npm run build + +# Production stage FROM nginx:stable-alpine -# Copy the contents of the repo to the container -COPY ./dist /usr/share/nginx/html +# Copy built files from builder stage +COPY --from=builder /app/dist /usr/share/nginx/html # Move the customized nginx config file to the nginx folder RUN mv /usr/share/nginx/html/.docker/default.conf /etc/nginx/conf.d/default.conf