services:
  mysql:
    image: mysql:8.0
    container_name: developer-mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: root123456
      MYSQL_DATABASE: verification_platform
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./database/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
    networks:
      - developer-network

  redis:
    image: redis:7.0-alpine
    container_name: developer-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - developer-network

  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: developer-app
    restart: unless-stopped
    environment:
      - APP_ENV=production
      - DATABASE_HOST=mysql
      - DATABASE_PORT=3306
      - DATABASE_NAME=verification_platform
      - DATABASE_USERNAME=root
      - DATABASE_PASSWORD=root123456
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    ports:
      - "8080:8080"
    volumes:
      - uploads:/app/uploads
    depends_on:
      - mysql
      - redis
    networks:
      - developer-network

volumes:
  mysql_data:
  redis_data:
  uploads:

networks:
  developer-network:
    driver: bridge
