version: "3.7"

services:
  nginxsrv:
    image: nginx:alpine
    ports:
      - "443:443"
    volumes:
      - $PWD:/var/www/html
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/nginx/cert:/etc/nginx/cert
      - $PWD/conf/nginx/nginx-prod-https.conf:/etc/nginx/nginx.conf:ro
    links:
      - mobilesrv
      - fpmsrv
    container_name: "panda-nginx"
    command: [nginx,'-g','daemon off;']

  redisrv:
    image: redis:alpine
    ports:
      - "6379:6379"
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD/conf/redis/6379.conf:/usr/local/etc/redis/redis.conf
      - $PWD/conf/redis:/var/redis
    container_name: "panda-redis"
    command: [ "redis-server"]

  mobilesrv:
    image: php-zts-debug:7.3.18
    ports:
      - "9100:9100"
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD:/var/www/html
      - $PWD/conf/php/php.ini:/usr/local/etc/php/php.ini
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/php/docker-php-start:/usr/local/bin/docker-php-start
    links:
      - redisrv
    container_name: "panda-mobile"
    command: ['docker-php-start']
    depends_on:
      - "redisrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"

  fpmsrv:
    image: php-fpm:alpine
    ports:
      - "9000:9000"
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD:/var/www/html
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/php-fpm/php.ini:/usr/local/etc/php/php.ini
      - $PWD/conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
      - $PWD/conf/php-fpm/docker-php-fpm-start:/usr/local/bin/docker-php-fpm-start
    container_name: "panda-web"
    command: [docker-php-fpm-start]
    depends_on:
      - "redisrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"

  QueueSrv:
    image: php-zts-debug:7.3.18
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD:/var/www/html
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/php/php.ini:/usr/local/etc/php/php.ini
      - $PWD/conf/queue/docker-queue-start:/usr/local/bin/docker-queue-start
    links:
      - redisrv
    container_name: "panda-queue"
    command: [docker-queue-start]
    depends_on:
      - "redisrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"

  SearchSrv:
    image: php-zts-debug:7.3.18
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD:/var/www/html
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/php/php.ini:/usr/local/etc/php/php.ini
      - $PWD/conf/searcher/docker-search-start:/usr/local/bin/docker-start
    links:
      - redisrv
    container_name: "panda-searcher"
    command: [docker-start]
    depends_on:
      - "redisrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"

  crontabsrv:
    image: php-zts-debug:7.3.18
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD:/var/www/html
      - /mnt/upload:/var/www/html/data/upload
      - $PWD/conf/php/php.ini:/usr/local/etc/php/php.ini
      - $PWD/conf/crontab/root:/var/spool/cron/crontabs/root
      - $PWD/conf/crontab/docker-start:/usr/local/bin/docker-start
    links:
      - redisrv
    container_name: "panda-crontab"
    command: [docker-start]
    depends_on:
      - "redisrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"

  phpcli:
    image: php-zts-debug:7.3.18
    volumes:
      - $PWD/conf/etc/localtime:/etc/localtime:ro
      - $PWD/conf/php/php.ini:/usr/local/etc/php/php.ini
      - $PWD:/var/www/html
      - /mnt/upload:/var/www/html/data/upload
    links:
      - redisrv
    container_name: "panda-php"
    depends_on:
      - "redisrv"
      - "fpmsrv"
      - "SearchSrv"
    extra_hosts:
      - "docker.hostip:172.17.0.1"
      - "eth.hostip:172.26.105.125"