Deployment
Docker build, CI pipeline, and production deployment flow.
This guide covers building and deploying Angular applications using Docker and the standard CI/CD pipeline.
Build for production
ng build --configuration=productionOutput is written to dist/admin-console/browser/. Verify bundle size:
ls -lh dist/admin-console/browser/Dockerfile
Multi-stage build for minimal production image:
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm ng build --configuration=production
# Stage 2: Serve
FROM nginx:alpine
COPY --from=builder /app/dist/admin-console/browser /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]nginx.conf
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /health {
return 200 'ok';
add_header Content-Type text/plain;
}
}CI pipeline
- name: Build Angular
run: |
pnpm install --frozen-lockfile
pnpm ng lint
pnpm ng test --watch=false --browsers=ChromeHeadless
pnpm ng build --configuration=production
- name: Build & push Docker image
run: |
docker build -t $REGISTRY/admin-console:$TAG .
docker push $REGISTRY/admin-console:$TAGDeployment checklist
- Confirm
environment.prod.tshas correct API URL and Cognito IDs. - Build passes locally with production configuration.
- Docker image builds and health check responds.
- Deploy to staging and verify login + core workflows.
- Promote to production after code owner approval.