151 lines
3.6 KiB
YAML
151 lines
3.6 KiB
YAML
# 🎨 MYP Frontend - Standalone Server Konfiguration
|
|
# Frontend-Service als vollständig unabhängiger Server
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# === FRONTEND SERVICE ===
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- BUILDKIT_INLINE_CACHE=1
|
|
- NODE_ENV=${NODE_ENV:-production}
|
|
image: myp/frontend:latest
|
|
container_name: myp-frontend-standalone
|
|
restart: unless-stopped
|
|
|
|
environment:
|
|
- NODE_ENV=${NODE_ENV:-production}
|
|
- NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# Backend API Konfiguration
|
|
- NEXT_PUBLIC_API_URL=${BACKEND_API_URL:-http://localhost:5000/api}
|
|
- NEXT_PUBLIC_BACKEND_HOST=${BACKEND_HOST:-localhost:5000}
|
|
|
|
# Frontend Server
|
|
- PORT=3000
|
|
- HOSTNAME=0.0.0.0
|
|
|
|
# Auth Konfiguration
|
|
- NEXTAUTH_URL=${FRONTEND_URL:-http://localhost:3000}
|
|
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-frontend-auth-secret}
|
|
|
|
volumes:
|
|
- frontend_data:/app/.next
|
|
- frontend_cache:/app/.next/cache
|
|
- ./public:/app/public:ro
|
|
|
|
ports:
|
|
- "3000:3000" # Direkter Port-Zugang für Frontend-Server
|
|
|
|
networks:
|
|
- frontend-network
|
|
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
labels:
|
|
- "service.type=frontend"
|
|
- "service.name=myp-frontend"
|
|
- "service.environment=${NODE_ENV:-production}"
|
|
|
|
# === FRONTEND CACHE (Optional: Redis für Session Management) ===
|
|
frontend-cache:
|
|
image: redis:7.2-alpine
|
|
container_name: myp-frontend-cache
|
|
restart: unless-stopped
|
|
|
|
command: redis-server --appendonly yes --requirepass ${FRONTEND_REDIS_PASSWORD:-frontend_cache_password}
|
|
|
|
volumes:
|
|
- frontend_redis_data:/data
|
|
|
|
ports:
|
|
- "6380:6379" # Separater Port vom Backend-Cache
|
|
|
|
networks:
|
|
- frontend-network
|
|
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
# === FRONTEND CDN/NGINX (Statische Assets) ===
|
|
frontend-cdn:
|
|
image: nginx:alpine
|
|
container_name: myp-frontend-cdn
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
- ./public:/usr/share/nginx/html/static:ro
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- frontend_cdn_cache:/var/cache/nginx
|
|
|
|
ports:
|
|
- "8080:80" # Separater Port für statische Assets
|
|
|
|
networks:
|
|
- frontend-network
|
|
|
|
depends_on:
|
|
- frontend
|
|
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
labels:
|
|
- "service.type=cdn"
|
|
- "service.name=myp-frontend-cdn"
|
|
|
|
# === PERSISTENTE VOLUMES ===
|
|
volumes:
|
|
frontend_data:
|
|
driver: local
|
|
|
|
frontend_cache:
|
|
driver: local
|
|
|
|
frontend_redis_data:
|
|
driver: local
|
|
|
|
frontend_cdn_cache:
|
|
driver: local
|
|
|
|
# === FRONTEND-NETZWERK ===
|
|
networks:
|
|
frontend-network:
|
|
driver: bridge
|
|
driver_opts:
|
|
com.docker.network.enable_ipv6: "false"
|
|
com.docker.network.bridge.enable_ip_masquerade: "true"
|
|
labels:
|
|
- "description=MYP Frontend Server Netzwerk"
|
|
- "project=myp-frontend"
|
|
- "tier=frontend"
|
|
|
|
# === KONFIGURATION FÜR FRONTEND ===
|
|
x-frontend-defaults: &frontend-defaults
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
labels: "service,environment,tier"
|
|
|
|
x-healthcheck-frontend: &frontend-healthcheck
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s |