services:
  app:
    build: 
      context: .
      target: development
    container_name: colih-app-dev
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - /var/www/html/node_modules
      - /var/www/html/vendor
    environment:
      # Apenas variáveis que precisam ser diferentes do .env
      - DB_HOST=db
      - DB_DATABASE=colih_dev
      - DB_USERNAME=colih_dbuser
      - DB_PASSWORD=colih_password
      - REDIS_HOST=redis
    depends_on:
      - db
      - redis
    networks:
      - colih-network

  db:
    image: mysql:8.0
    container_name: colih-db-dev
    restart: always
    environment:
      MYSQL_DATABASE: colih_dev
      MYSQL_USER: colih_dbuser
      MYSQL_PASSWORD: colih_password
      MYSQL_ROOT_PASSWORD: root
      MYSQL_CHARACTER_SET_SERVER: utf8mb4
      MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
    volumes:
      - db_dev_data:/var/lib/mysql
    ports:
      - "3308:3306"
    networks:
      - colih-network
    command: --default-authentication-plugin=mysql_native_password

  redis:
    image: redis:7-alpine
    container_name: colih-redis-dev
    restart: always
    ports:
      - "6380:6379"
    volumes:
      - redis_dev_data:/data
    networks:
      - colih-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: colih-pma-dev
    restart: always
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: root
    ports:
      - "8082:80"
    depends_on:
      - db
    networks:
      - colih-network

volumes:
  db_dev_data:
  redis_dev_data:

networks:
  colih-network:
    driver: bridge
