version: '3.8' # Upgrade version for healthcheck support services: # Backend: Laravel laravel-app: image: laravel-app:latest build: context: . dockerfile: docker/laravel/Dockerfile volumes: - ./app:/var/www/html networks: - app-network depends_on: - mysql healthcheck: test: ["CMD-SHELL", "curl -f http://localhost || exit 1"] interval: 30s timeout: 10s retries: 5 start_period: 30s # Frontend: React (served with Nginx inside container) react-app: build: context: ./frontend dockerfile: Dockerfile volumes: - ./frontend:/app ports: - "80:80" networks: - app-network command: "nginx -g 'daemon off;'" healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://localhost"] interval: 30s timeout: 10s retries: 3 start_period: 20s # Nginx: Serves both Laravel and React nginx: image: nginx:latest volumes: - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf - ./public:/var/www/html/public ports: - "8080:80" networks: - app-network depends_on: - laravel-app healthcheck: test: ["CMD", "curl", "-f", "http://localhost"] interval: 30s timeout: 10s retries: 3 start_period: 20s # MySQL: Database mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root_password MYSQL_DATABASE: laravel_db volumes: - mysql-data:/var/lib/mysql networks: - app-network healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 30s timeout: 10s retries: 5 start_period: 30s networks: app-network: driver: bridge volumes: mysql-data: