version: '3'
services:
  protocol:
    build: .
    image: protocol
    container_name: protocol
    ports:
      - 28080:80
    env_file:
      - src/.env
    depends_on:
      db:
        condition: service_healthy
    volumes:
      - ./src:/app
  protocol_stand_alone:
    restart: "no"
    build: .
    image: 
    environment:
      - CONTAINER_APP_UPDATE=true
    depends_on:
      db:
        condition: service_healthy
  redis:
    image: "redis:alpine"
    container_name: protocol_redis
    environment:
      - REDIS_REPLICATION_MODE=master  
  protocol_wredis:
    build: .
    image: 
    container_name: protocol_wredis
    environment:
      - SV_MONITOR_START=false
      - SV_NGINX_START=false
      - SV_PHPFPM_START=false
      - SV_WREDIS_START=true
      #- SV_WREDIS_PROC_NUM=5
    entrypoint: ./entrypoint.sh wredis
    depends_on:
      db:
        condition: service_healthy
  db:
    image: mysql:8.4.0
    container_name: protocol_db
    ports:
      - 33306:3306
    volumes:
      - dbdata:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=protocol
      - MYSQL_DATABASE=protocol
      - MYSQL_USER=protocol
      - MYSQL_PASSWORD=protocol
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      timeout: 5s
      retries: 3
volumes:
  dbdata:
    driver: local
