version: "3"

services:

  app:
    build:
      context: ./
      dockerfile: .docker/node/Dockerfile
    container_name: whatsappBot-app
    restart: unless-stopped
    ports:
      - '${PORT:-3333}:3333'
    volumes:
      - '.:/usr/app'
    depends_on:
      - db
    networks:
      - code49-network
      - backend

  db:
    image: mariadb
    container_name: whatsappBot-db
    restart: unless-stopped
    ports:
      - "33000:3306"
    volumes:
      - "db_data_whatsappBot:/var/lib/mysql"
      - "./.docker/mysql:/docker-entrypoint-initdb.d"
    environment:
      MYSQL_ROOT_PASSWORD: secret
    networks:
      - backend

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: whatsappBot-phpmyadmin
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: root
      PMA_HOST: whatsappBot-db
      PMA_PORT: 3306
    ports:
      - "33:33"
    depends_on:
      - db
    networks:
      - backend

networks:
  code49-network:
    external: true
  backend:
    driver: bridge


volumes:
  db_data_whatsappBot:
