From c46f899e10befe3b777fa7fbfca68957fb2fd103 Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Sun, 9 Nov 2025 22:30:11 +0300 Subject: [PATCH] update docker files --- Dockerfile.prod | 22 +++++++--------------- docker-compose.prod.yml | 4 ++-- docker-compose.yml | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Dockerfile.prod b/Dockerfile.prod index a75ed5f..ff2e332 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -1,33 +1,25 @@ -# Multi-stage build for production -# Stage 1: Build the React application +# Stage 1: Build the Vite application FROM node:20-alpine AS build -# Set working directory WORKDIR /app -# Copy package files -COPY package.json yarn.lock ./ - # Install dependencies +COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile -# Copy source code +# Copy source code and build COPY . . - -# Build the application for production RUN yarn build # Stage 2: Serve with nginx -FROM nginx:alpine +FROM nginx:1.27-alpine -# Copy custom nginx configuration +# Copy nginx configuration tuned for a single-page application COPY nginx.conf /etc/nginx/nginx.conf -# Copy built application from build stage -COPY --from=build /app/build /usr/share/nginx/html +# Copy built assets +COPY --from=build /app/dist /usr/share/nginx/html -# Expose port 80 EXPOSE 80 -# Start nginx CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9dd9643..426ef94 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile.prod ports: - - '3009:80' + - '3010:80' environment: - NODE_ENV=production env_file: @@ -15,7 +15,7 @@ services: networks: - dashboard-network healthcheck: - test: ['CMD', 'curl', '-f', 'http://localhost/health'] + test: ['CMD', 'curl', '-f', 'http://localhost/'] interval: 30s timeout: 10s retries: 3 diff --git a/docker-compose.yml b/docker-compose.yml index 0884e1f..b518b32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile ports: - - '3008:3000' + - '3011:3000' volumes: # Mount source code for hot reloading - .:/app