version: '3.8'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: chatbot-app
    container_name: chatbot-app
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www
    volumes:
      - ./:/var/www
      - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
    networks:
      - chatbot-network

  nginx:
    image: nginx:alpine
    container_name: chatbot-nginx
    restart: unless-stopped
    tty: true
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www
      - ./nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - chatbot-network

  db:
    image: mysql:8.0
    container_name: chatbot-db
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_USER: ${DB_USERNAME}
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    volumes:
      - dbdata:/var/lib/mysql/
    networks:
      - chatbot-network

  redis:
    image: redis:alpine
    container_name: chatbot-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    networks:
      - chatbot-network

  mailhog:
    image: mailhog/mailhog:latest
    container_name: chatbot-mailhog
    ports:
      - "1025:1025"
      - "8025:8025"
    networks:
      - chatbot-network

networks:
  chatbot-network:
    driver: bridge

volumes:
  dbdata:
    driver: local
