101 lines
2.5 KiB
YAML
101 lines
2.5 KiB
YAML
services:
|
|
# MySQL Database
|
|
mysql:
|
|
image: mysql:8.0
|
|
container_name: rezepte-mysql
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: rootpassword
|
|
MYSQL_DATABASE: rezepte_klaus
|
|
MYSQL_USER: rezepte_user
|
|
MYSQL_PASSWORD: rezepte_pass
|
|
ports:
|
|
- "0.0.0.0:3307:3306" # Bind to all interfaces
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
- ./sql-init:/docker-entrypoint-initdb.d
|
|
networks:
|
|
- rezepte-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
timeout: 20s
|
|
retries: 10
|
|
|
|
# Backend API
|
|
backend:
|
|
build:
|
|
context: ./nodejs-version/backend
|
|
dockerfile: Dockerfile
|
|
container_name: rezepte-backend
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3001
|
|
DATABASE_URL: mysql://rezepte_user:rezepte_pass@mysql:3306/rezepte_klaus
|
|
JWT_SECRET: your-super-secret-jwt-key-change-in-production
|
|
UPLOAD_PATH: /app/uploads
|
|
MAX_FILE_SIZE: 5242880
|
|
# Allow access from any IP in local network
|
|
CORS_ORIGIN: "*"
|
|
ports:
|
|
- "0.0.0.0:3001:3001" # Bind to all interfaces
|
|
volumes:
|
|
- uploads_data:/app/uploads
|
|
- ./uploads:/app/legacy-uploads:ro # Mount existing uploads as read-only
|
|
networks:
|
|
- rezepte-network
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Frontend Application
|
|
frontend:
|
|
build:
|
|
context: ./nodejs-version/frontend
|
|
dockerfile: Dockerfile
|
|
args:
|
|
# Use host IP instead of localhost for API calls
|
|
VITE_API_URL: http://${HOST_IP:-192.168.1.100}:3001/api
|
|
container_name: rezepte-frontend
|
|
ports:
|
|
- "0.0.0.0:3000:80" # Bind to all interfaces
|
|
networks:
|
|
- rezepte-network
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:80"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Legacy PHP Application (optional)
|
|
php-app:
|
|
build: .
|
|
container_name: rezepte-php-legacy
|
|
ports:
|
|
- "0.0.0.0:8080:80" # Bind to all interfaces
|
|
volumes:
|
|
- ./uploads:/var/www/html/uploads
|
|
- .:/var/www/html
|
|
networks:
|
|
- rezepte-network
|
|
depends_on:
|
|
- mysql
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
mysql_data:
|
|
driver: local
|
|
uploads_data:
|
|
driver: local
|
|
|
|
networks:
|
|
rezepte-network:
|
|
driver: bridge |