version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: corelux_api_app
    restart: unless-stopped
    working_dir: /var/www/corelux_api
    volumes:
      - ./:/var/www/corelux_api
      - ./storage:/var/www/corelux_api/storage
    ports:
      - "9010:9010"
    environment:
      - APP_ENV=local
      - APP_DEBUG=true
      - DB_CONNECTION=mysql
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_DATABASE=corelux_api
      - DB_USERNAME=corelux_user
      - DB_PASSWORD=corelux_password
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    depends_on:
      - mysql
      - redis
    networks:
      - corelux_network

  mysql:
    image: mysql:8.0
    container_name: corelux_api_mysql
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: corelux_api
      MYSQL_USER: corelux_user
      MYSQL_PASSWORD: corelux_password
      MYSQL_ROOT_PASSWORD: root_password
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - "3308:3306"
    networks:
      - corelux_network

  redis:
    image: redis:7-alpine
    container_name: corelux_api_redis
    restart: unless-stopped
    ports:
      - "6380:6379"
    volumes:
      - redis_data:/data
    networks:
      - corelux_network

volumes:
  mysql_data:
  redis_data:

networks:
  corelux_network:
    driver: bridge
