# Copyright (c) Facebook, Inc. and its affiliates.

# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version: '3'

volumes:
  whatsappMedia:
    driver: local

services:
  wacore:
    image: docker.whatsapp.biz/coreapp:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.39.2 docker-compose <command> <options>)}
    command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
    volumes:
     - whatsappMedia:/usr/local/wamedia
    env_file:
      - db.env
    environment:
      # This is the version of the docker templates being used to run WhatsApp Business API
      WA_RUNNING_ENV_VERSION: v2.2.3
      ORCHESTRATION: DOCKER-COMPOSE
    network_mode: bridge
    cap_drop:
      - MKNOD
  waweb:
    image: docker.whatsapp.biz/web:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.39.2 docker-compose <command> <options>)}
    command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
    ports:
     - "9090:443"
    volumes:
     - whatsappMedia:/usr/local/wamedia
    env_file:
      - db.env
    environment:
      WACORE_HOSTNAME: wacore
      # This is the version of the docker templates being used to run WhatsApp Business API
      WA_RUNNING_ENV_VERSION: v2.2.3
      ORCHESTRATION: DOCKER-COMPOSE
    depends_on:
      - "wacore"
    links:
      - wacore
    network_mode: bridge
    cap_drop:
      - MKNOD
