version: "3"
services:
  nginx:
    build:
      context: ./services/nginx
      args:
        NGINX_VERSION: harbor.gaore.com/tools/nginx
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        NGINX_INSTALL_APPS: ${NGINX_INSTALL_APPS}
    container_name: nginx_harbor
    ports:
      - "${NGINX_HTTP_HOST_PORT}:80"
      - "${NGINX_HTTPS_HOST_PORT}:443"
    # - "${NGINX_WS_HOST_PORT}:9000"
    volumes:
      - ${SOURCE_DIR}:/www/gaore:rw
      - ${NGINX_SSL_CERTIFICATE_DIR}:/ssl:rw
      - ${NGINX_CONFD_DIR}:/etc/nginx/conf.d/:rw
      - ${NGINX_CONF_FILE}:/etc/nginx/nginx.conf:ro
    # - ${PHP_HOSTS_FILE}:/etc/hosts:rw
    # - /etc/hosts:/etc/hosts:rw
      - ${NGINX_FASTCGI_PHP_CONF}:/etc/nginx/fastcgi-php.conf:ro
      - ${NGINX_FASTCGI_PARAMS}:/etc/nginx/fastcgi_params:ro
      - ${NGINX_LOG_DIR}:/var/log/nginx/:rw
    environment:
      TZ: "$TZ"
    # restart: always
    networks:
      dev-network:
        ipv4_address: 172.20.0.254
    extra_hosts:
      - "host.docker.internal:host-gateway"

  php53:
    build:
      context: ./services/php53
      args:
        PHP_VERSION: harbor.gaore.com/tools/php53-fpm
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        PHP_EXTENSIONS: ${PHP53_EXTENSIONS}
        TZ: "$TZ"
    container_name: php53_harbor
    ports:
      - ${PHP53_LISTEN_PORT}:9000
    env_file:
      - ./docker.env
    volumes:
      - ${SOURCE_DIR}:/www/gaore:rw
      - ./hosts:/etc/hosts:rw
      - ${PHP53_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
      - ${PHP53_FPM_CONF_FILE}:/usr/local/etc/php-fpm.conf:rw
      - ${PHP53_LOG_DIR}:/var/log/php:rw
      - ${DATA_DIR}/composer:/tmp/composer
    # restart: always
    cap_add:
      - SYS_PTRACE
    networks:
      - dev-network
  
  php56:
    build:
      context: ./services/php56
      args:
        PHP_VERSION: harbor.gaore.com/tools/php56-fpm
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        PHP_EXTENSIONS: ${PHP56_EXTENSIONS}
        TZ: "$TZ"
    container_name: php56_harbor
    ports:
      - ${PHP56_LISTEN_PORT}:9000
    env_file:
      - ./docker.env
    volumes:
      - ${SOURCE_DIR}:/www/gaore:rw
      - ./hosts:/etc/hosts:rw
      - ${PHP56_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
      - ${PHP56_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
      - ${PHP56_LOG_DIR}:/var/log/php:rw
      - ${DATA_DIR}/composer:/tmp/composer
    # restart: always
    cap_add:
      - SYS_PTRACE
    networks:
      - dev-network
  
  php70:
    build:
      context: ./services/php70
      args:
        PHP_VERSION: harbor.gaore.com/tools/php-7.0.5-fpm
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        PHP_EXTENSIONS: ${PHP70_EXTENSIONS}
        TZ: "$TZ"
    container_name: php70_harbor
    ports:
      - ${PHP70_LISTEN_PORT}:9000
    env_file:
      - ./docker.env
    volumes:
      - ${SOURCE_DIR}:/www/gaore:rw
      - ./hosts:/etc/hosts:rw
      - ${PHP70_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
      - ${PHP70_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
      - ${PHP70_LOG_DIR}:/var/log/php:rw
      - ${DATA_DIR}/composer:/tmp/composer
    # restart: always
    cap_add:
      - SYS_PTRACE
    networks:
      - dev-network
  
  php71:
    build:
      context: ./services/php71
      args:
        PHP_VERSION: harbor.gaore.com/tools/php71-fpm
        CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
        PHP_EXTENSIONS: ${PHP71_EXTENSIONS}
        TZ: "$TZ"
    container_name: php71_harbor
    ports:
      - ${PHP71_LISTEN_PORT}:9000
    env_file:
      - ./docker.env
    volumes:
      - ${SOURCE_DIR}:/www/gaore:rw
      - ./hosts:/etc/hosts:rw
      - ${PHP71_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
      - ${PHP71_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
      - ${PHP71_LOG_DIR}:/var/log/php:rw
      - ${DATA_DIR}/composer:/tmp/composer
    # restart: always
    cap_add:
      - SYS_PTRACE
    networks:
      - dev-network


networks:
  dev-network:
    external: false
    ipam:
      config:
        - subnet: 172.20.0.0/24  # 指定子网
       
