95 lines
2.2 KiB
YAML
95 lines
2.2 KiB
YAML
version: '3'
|
|
|
|
services:
|
|
# Backend (Flask) auf Port 443 mit SSL
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: myp-backend
|
|
restart: unless-stopped
|
|
hostname: raspberrypi
|
|
ports:
|
|
- "80:80" # HTTP Fallback
|
|
- "443:443" # HTTPS
|
|
volumes:
|
|
- ./backend:/app
|
|
- ./backend/logs:/app/logs
|
|
- ./backend/instance:/app/instance
|
|
networks:
|
|
- myp-network
|
|
environment:
|
|
- FLASK_APP=app/app.py
|
|
- FLASK_ENV=production
|
|
- SSL_ENABLED=true
|
|
- SSL_HOSTNAME=raspberrypi
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-k", "https://localhost:443/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Next.js Frontend
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: myp-rp
|
|
restart: unless-stopped
|
|
environment:
|
|
- NODE_ENV=production
|
|
- NEXT_PUBLIC_API_URL=https://raspberrypi:443
|
|
- NEXT_PUBLIC_BACKEND_HOST=raspberrypi:443
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
- /app/.next
|
|
ports:
|
|
- "3000:3000"
|
|
networks:
|
|
- myp-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Caddy Proxy für Frontend auf Port 443 mit SSL
|
|
caddy:
|
|
image: caddy:2.7-alpine
|
|
container_name: myp-caddy
|
|
restart: unless-stopped
|
|
hostname: m040tbaraspi001
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./frontend/docker/caddy/Caddyfile:/etc/caddy/Caddyfile
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
- ./backend/instance/ssl:/etc/caddy/ssl
|
|
networks:
|
|
- myp-network
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
- "raspberrypi:backend"
|
|
- "m040tbaraspi001.de040.corpintra.net:127.0.0.1"
|
|
environment:
|
|
- CADDY_HOST=m040tbaraspi001.de040.corpintra.net
|
|
- CADDY_DOMAIN=m040tbaraspi001.de040.corpintra.net
|
|
cap_add:
|
|
- NET_ADMIN
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
|
|
networks:
|
|
myp-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
caddy_data:
|
|
caddy_config:
|
|
backend_ssl: |