version: '3.8' services: # Java Web Application app: image: your-java-app:latest container_name: java-app restart: unless-stopped networks: - app-network environment: - SPRING_PROFILES_ACTIVE=prod - SERVER_PORT=8080 # ports: # - "8080:8080" # Non esporre direttamente, usa nginx volumes: - app-data:/app/data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # Nginx Reverse Proxy nginx: image: nginx:alpine container_name: nginx-proxy restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx/conf.d:/etc/nginx/conf.d:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - certbot-webroot:/var/www/certbot:ro - certbot-certs:/etc/letsencrypt:ro - certbot-lib:/var/lib/letsencrypt:ro networks: - app-network depends_on: - app healthcheck: test: ["CMD", "nginx", "-t"] interval: 30s timeout: 10s retries: 3 # Certbot per Let's Encrypt - Auto Renewal certbot: image: certbot/certbot:latest container_name: certbot volumes: - certbot-webroot:/var/www/certbot:rw - certbot-certs:/etc/letsencrypt:rw - certbot-lib:/var/lib/letsencrypt:rw - certbot-logs:/var/log/letsencrypt:rw - ./certbot-entrypoint.sh:/entrypoint.sh:ro entrypoint: /entrypoint.sh networks: - app-network networks: app-network: driver: bridge volumes: app-data: certbot-webroot: certbot-certs: certbot-lib: certbot-logs: