- Create multi-stage standalone Dockerfile for Next.js frontend (node:20-alpine, non-root nextjs:nodejs user) - Configure output: 'standalone' in refer_landing_page/next.config.js - Add refer_landing_page/.dockerignore for build context optimization - Wire anl-backend and anl-frontend services in root docker-compose.yml with healthchecks, network dependencies, and persistent volume storage
52 lines
1.2 KiB
YAML
52 lines
1.2 KiB
YAML
services:
|
|
anl-backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: anl-backend-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
- HOST=0.0.0.0
|
|
- PORT=8080
|
|
- DB_PATH=/app/data/anl.db
|
|
- GIN_MODE=release
|
|
- CORS_ALLOW_ORIGINS=*
|
|
- AUTO_MIGRATE=true
|
|
- ADMIN_TOKEN=${ADMIN_TOKEN:-anl-admin-secret-token-2026}
|
|
volumes:
|
|
- anl-db-data:/app/data
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
anl-frontend:
|
|
build:
|
|
context: ./refer_landing_page
|
|
dockerfile: Dockerfile
|
|
container_name: anl-frontend-web
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3000
|
|
- NEXT_PUBLIC_API_URL=http://localhost:8080/api/v1
|
|
depends_on:
|
|
anl-backend:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
|
|
interval: 15s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
anl-db-data:
|
|
name: anl-sqlite-storage
|