From 426875abc70e18542dc52755ed39a7fe8ce71602 Mon Sep 17 00:00:00 2001 From: mukesh13 Date: Mon, 23 Jun 2025 19:54:57 +0530 Subject: [PATCH] Docker update --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2058abf..6fc9b2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,18 @@ -# Build stage FROM node:18 AS build WORKDIR /app +# Copy only package files first (better caching) COPY package*.json ./ -RUN npm install --legacy-peer-deps +# This layer will be cached if package.json doesn't change +RUN npm ci --legacy-peer-deps + +# Copy source code (this changes more often) COPY . . RUN npm run build -# Production stage FROM nginx:alpine - COPY --from=build /app/public /usr/share/nginx/html - -# Fix for Gatsby client-side routing RUN echo 'server { listen 80; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf - EXPOSE 80 \ No newline at end of file