From 6fc27d0897d8ba395de3674c5441dfc595b23bb2 Mon Sep 17 00:00:00 2001 From: mukeshs Date: Thu, 16 Oct 2025 21:21:16 +0530 Subject: [PATCH] docker update --- fuse-starter-v20.0.0/.dockerignore | 7 ++++++ fuse-starter-v20.0.0/Dockerfile | 38 ++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 fuse-starter-v20.0.0/.dockerignore diff --git a/fuse-starter-v20.0.0/.dockerignore b/fuse-starter-v20.0.0/.dockerignore new file mode 100644 index 0000000..dec5334 --- /dev/null +++ b/fuse-starter-v20.0.0/.dockerignore @@ -0,0 +1,7 @@ +node_modules +.git +.gitignore +Dockerfile +docker-compose.yml +README.md +dist diff --git a/fuse-starter-v20.0.0/Dockerfile b/fuse-starter-v20.0.0/Dockerfile index 04c039f..3237d8b 100644 --- a/fuse-starter-v20.0.0/Dockerfile +++ b/fuse-starter-v20.0.0/Dockerfile @@ -1,35 +1,49 @@ -# Stage 1: Build Angular application +# =============================== +# Stage 1: Build Angular app +# =============================== FROM node:18-alpine AS builder +# Set working directory WORKDIR /app -# Copy package files +# Copy only package files first (for caching) COPY package*.json ./ -# Install dependencies -RUN npm ci --legacy-peer-deps +# Install dependencies efficiently +# --legacy-peer-deps fixes Angular peer conflicts +# --no-audit and --no-fund speed up installation +RUN npm ci --legacy-peer-deps --no-audit --no-fund -# Copy source code +# Copy source code (after dependencies cached) COPY . . -# Build the application -RUN npm run build +# Build the Angular app in production mode +# Disable analytics + progress bar to reduce overhead +RUN npm run build -- --configuration production --no-progress +# =============================== # Stage 2: Serve with Nginx +# =============================== FROM nginx:alpine AS production -# Copy built artifacts +# Copy built Angular files from builder COPY --from=builder /app/dist/fuse-angular /usr/share/nginx/html -# Nginx config for Angular routing +# Angular-friendly Nginx config RUN echo 'server { \ listen 80; \ + server_name localhost; \ + root /usr/share/nginx/html; \ + index index.html; \ location / { \ - root /usr/share/nginx/html; \ - index index.html; \ try_files $uri $uri/ /index.html; \ } \ + location /api/ { \ + proxy_pass http://backend:5000/; \ + } \ }' > /etc/nginx/conf.d/default.conf EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file + +# Run Nginx in foreground +CMD ["nginx", "-g", "daemon off;"]