From 10a15e4b93425003a740d59c854105f8886ff715 Mon Sep 17 00:00:00 2001 From: mukesh13 Date: Mon, 23 Jun 2025 21:56:40 +0530 Subject: [PATCH] Dockerupdate --- Dockerfile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index b9208cb..d5a39bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,17 @@ # syntax=docker/dockerfile:1.4 -# Use Alpine - no apt-get, much faster! FROM node:18-alpine AS development WORKDIR /app -# Install build tools with apk (seconds vs minutes) +# Install build dependencies RUN apk add --no-cache python3 make g++ -# Copy package files first for better layer caching -COPY package.json package-lock.json* ./ +# Copy package files +COPY package.json package-lock.json ./ -# Install dependencies -RUN npm ci --legacy-peer-deps --no-optional +# Install dependencies +RUN npm ci --legacy-peer-deps # Copy source code COPY . . @@ -29,10 +28,17 @@ RUN npm run build # Production stage FROM nginx:alpine AS production -# Copy nginx config if it exists, otherwise use default -COPY --from=build /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf 2>/dev/null || echo "Using default nginx config" +WORKDIR /usr/share/nginx/html + +# Remove default nginx files +RUN rm -rf ./* # Copy built app -COPY --from=build /app/build /usr/share/nginx/html +COPY --from=build /app/build . + +# Copy nginx config if it exists +COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file