Projektarbeit-MYP/frontend/docker-compose.frontend.yml
Till Tomczak 62e131c02f """
feat: Update frontend and backend configurations for development environment

- Downgrade PyP100 version in requirements.txt for compatibility.
- Add new frontend routes for index, login, dashboard, printers, jobs, and profile pages.
- Modify docker-compose files for development setup, including environment variables and service names.
- Update Caddyfile for local development with Raspberry Pi backend.
- Adjust health check route to use updated backend URL.
- Enhance setup-backend-url.sh for development environment configuration.
"""
2025-05-24 18:58:17 +02:00

159 lines
3.6 KiB
YAML

# 🎨 MYP Frontend - Entwicklungsumgebung Konfiguration
# Frontend-Service für die Entwicklung mit Raspberry Pi Backend
version: '3.8'
services:
# === FRONTEND SERVICE ===
frontend:
build:
context: .
dockerfile: Dockerfile.dev
args:
- BUILDKIT_INLINE_CACHE=1
- NODE_ENV=development
image: myp/frontend:dev
container_name: myp-frontend-dev
restart: unless-stopped
environment:
- NODE_ENV=development
- NEXT_TELEMETRY_DISABLED=1
# Backend API Konfiguration (Raspberry Pi)
- NEXT_PUBLIC_API_URL=http://192.168.0.105:5000
- NEXT_PUBLIC_BACKEND_HOST=192.168.0.105:5000
# Frontend Server
- PORT=3000
- HOSTNAME=0.0.0.0
# Auth Konfiguration (Entwicklung)
- NEXTAUTH_URL=http://localhost:3000
- NEXTAUTH_SECRET=dev-frontend-auth-secret
# Debug-Einstellungen
- DEBUG=true
- NEXT_DEBUG=true
volumes:
- .:/app
- /app/node_modules
- /app/.next
- ./public:/app/public:ro
ports:
- "3000:3000" # Direkter Port-Zugang für Frontend-Server
networks:
- frontend-network
extra_hosts:
- "raspberrypi:192.168.0.105"
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-dev"
- "service.environment=development"
# === 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