From a514fc8e97210193f6a7ad5bcdcc92153183e294 Mon Sep 17 00:00:00 2001 From: mukeshs Date: Thu, 16 Oct 2025 22:09:07 +0530 Subject: [PATCH] docker update --- docker-compose.yml | 24 ++++-------- fuse-starter-v20.0.0/Dockerfile | 69 +++++---------------------------- 2 files changed, 18 insertions(+), 75 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9390b8e..5c99a8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,34 +40,26 @@ services: db: condition: service_healthy restart: always - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:5000/health"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s command: > sh -c "python seed_user.py && gunicorn --bind 0.0.0.0:5000 --workers 2 --timeout 120 run:app" frontend: build: context: ./fuse-starter-v20.0.0 - dockerfile: Dockerfile + dockerfile: Dockerfile.dev container_name: vending-frontend ports: - - "8086:80" + - "8086:4200" + volumes: + - ./fuse-starter-v20.0.0:/project + - /project/node_modules networks: - vending-network depends_on: - backend: - condition: service_healthy + - backend restart: always - healthcheck: - test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s + environment: + - CHOKIDAR_USEPOLLING=true networks: vending-network: diff --git a/fuse-starter-v20.0.0/Dockerfile b/fuse-starter-v20.0.0/Dockerfile index ee67123..81861b1 100644 --- a/fuse-starter-v20.0.0/Dockerfile +++ b/fuse-starter-v20.0.0/Dockerfile @@ -1,70 +1,21 @@ -# =============================== -# Stage 1: Build Angular app -# =============================== -FROM node:18-alpine AS builder +FROM node:18-alpine -# Set working directory -WORKDIR /app +WORKDIR /project + +# Install Angular CLI 18 +RUN npm install -g @angular/cli@18.0.2 # Copy package files COPY package*.json ./ # Install dependencies -RUN npm ci --legacy-peer-deps --no-audit --no-fund +RUN npm ci --legacy-peer-deps # Copy source code COPY . . -# Build Angular app for production -RUN npm run build -- --configuration production --no-progress +# Expose development server port +EXPOSE 4200 -# =============================== -# Stage 2: Serve with Nginx -# =============================== -FROM nginx:alpine AS production - -# Copy built files from builder stage -COPY --from=builder /app/dist/fuse-angular /usr/share/nginx/html - -# Create custom Nginx configuration -COPY <<'EOF' /etc/nginx/conf.d/default.conf -server { - listen 80; - server_name localhost; - root /usr/share/nginx/html; - index index.html; - - # Enable gzip compression - gzip on; - gzip_types text/css application/javascript application/json image/svg+xml; - gzip_comp_level 6; - - # Angular routing - serve index.html for all routes - location / { - try_files $uri $uri/ /index.html; - } - - # Proxy API requests to backend - location /api/ { - proxy_pass http://backend:5000/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - # Cache static assets - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { - expires 1y; - add_header Cache-Control "public, immutable"; - } -} -EOF - -EXPOSE 80 - -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# Run development server +CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "4200", "--poll", "2000"] \ No newline at end of file