version: "3.7"

services:
  nginx:
    image: nginx:alpine
    ports:
      - ${ACCNGINX_PORT}:80
    volumes:
      - ../../:${ROOT_PATH}
      - ../conf/etc/localtime:/etc/localtime:ro
      - ../conf/nginx/api.conf:/etc/nginx/nginx.conf:ro
    container_name: "api-nginx"
    command: [ nginx,'-g','daemon off;' ]
    networks:
      - ${DOCKER_NET_NAME}

  redis:
    image: redis:alpine
    ports:
      - 6380:6379
    volumes:
      - ../conf/etc/localtime:/etc/localtime:ro
      - ../conf/redis/6379.conf:/etc/redis/redis.conf
      - ../conf/redis:/var/redis
      - ${REDIS_PATH}:/data
    container_name: "api-redis"
    command: [ redis-server,"/etc/redis/redis.conf" ]
    networks:
      - ${DOCKER_NET_NAME}

  web:
    image: php-fpm:alpine
    volumes:
      - ../conf/etc/localtime:/etc/localtime:ro
      - ../../:${ROOT_PATH}
      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
      - ../conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
      - ${RUNTIME_PATH}:${ROOT_PATH}/runtime
    container_name: "api-web"
    command: [php-fpm]
    networks:
      - ${DOCKER_NET_NAME}

networks:
  api_network:
    external: true