version: '3.8'

services:
  krayin:
    build: .
    container_name: krayin_app
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/html
    environment:
      APP_ENV: local
      APP_DEBUG: 'true'
      APP_URL: http://localhost:8000
      DB_HOST: mysql
      DB_PORT: 3306
      DB_DATABASE: laravel-crm
      DB_USERNAME: root
      DB_PASSWORD: ''
      REDIS_HOST: redis
      REDIS_PORT: 6379
      CACHE_DRIVER: redis
      SESSION_DRIVER: redis
      QUEUE_CONNECTION: redis
    depends_on:
      - mysql
      - redis
    networks:
      - krayin_net

  mysql:
    image: mysql:8.0
    container_name: krayin_mysql
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: laravel-crm
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - krayin_net

  redis:
    image: redis:alpine
    container_name: krayin_redis
    restart: unless-stopped
    volumes:
      - redis_data:/data
    networks:
      - krayin_net

networks:
  krayin_net:
    driver: bridge

volumes:
  mysql_data:
  redis_data:
