34 lines
694 B
Docker
34 lines
694 B
Docker
# Stage 1: Build Angular app
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build Angular app for production
|
|
RUN npm run build:prod
|
|
|
|
# Stage 2: Serve with nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy custom nginx config
|
|
COPY nginx.conf /etc/nginx/nginx.conf.template
|
|
|
|
# Copy built Angular app
|
|
COPY --from=builder /app/dist/cf-deployer-ui/browser /usr/share/nginx/html
|
|
|
|
# Set default backend URL
|
|
ENV BACKEND_URL=http://localhost:8080
|
|
|
|
# Replace env variables and start nginx
|
|
CMD envsubst '${BACKEND_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'
|
|
|
|
EXPOSE 80
|