docker update
This commit is contained in:
7
fuse-starter-v20.0.0/.dockerignore
Normal file
7
fuse-starter-v20.0.0/.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
README.md
|
||||
dist
|
||||
@ -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; \
|
||||
location / { \
|
||||
server_name localhost; \
|
||||
root /usr/share/nginx/html; \
|
||||
index index.html; \
|
||||
location / { \
|
||||
try_files $uri $uri/ /index.html; \
|
||||
} \
|
||||
location /api/ { \
|
||||
proxy_pass http://backend:5000/; \
|
||||
} \
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# Run Nginx in foreground
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user