version: '3.8'

services:
  laravel-backend:
    build:
      context: ./laravel-backend
      dockerfile: Dockerfile
    ports:
      - "8000:8000"
    volumes:
      - ./laravel-backend:/var/www/html
    environment:
      - DB_HOST=mysql
      - DB_DATABASE=onlyfans_db
      - DB_USERNAME=root
      - DB_PASSWORD=password
    depends_on:
      - mysql
      - redis

  nodejs-api:
    build:
      context: ./nodejs-api
      dockerfile: Dockerfile
    ports:
      - "3001:3001"
    volumes:
      - ./nodejs-api:/app
    environment:
      - DB_HOST=mysql
      - DB_DATABASE=onlyfans_db
      - DB_USERNAME=root
      - DB_PASSWORD=password
      - REDIS_HOST=redis
    depends_on:
      - mysql
      - redis

  react-frontend:
    build:
      context: ./react-frontend
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./react-frontend:/app
    depends_on:
      - laravel-backend
      - nodejs-api

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: onlyfans_db
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

volumes:
  mysql_data: