version: '3'
services:
  server:
    build:
      context: ./
      args:
        - CONTAINER_APP_DIR=${CONTAINER_APP_DIR}
        - INSTALL_COMPOSER=${INSTALL_COMPOSER}
        - COMPOSER_INSTALLER=${COMPOSER_INSTALLER}
        - COMPOSER_MIRROR=${COMPOSER_MIRROR}
        - INSTALL_LIB_EVENT=${INSTALL_LIB_EVENT}
        - CONTAINER_PACKAGE_URL=${CONTAINER_PACKAGE_URL}
        - CHANGE_AlPINE_SOURCE=${CHANGE_AlPINE_SOURCE}
    ports:
      - "${HOST_PORT_1}:${CONTAINER_PORT_1}"
    volumes:
      - ${HOST_APP_DIR}:${CONTAINER_APP_DIR}
      - ./id_rsa:/root/.ssh/id_rsa:ro
      - ./known_hosts:/root/.ssh/known_hosts:ro
    container_name: ${CONTAINER_NAME}
    stdin_open: true
    tty: true
    extra_hosts:
      - "host.docker.internal:host-gateway"
    #restart: always
    #entrypoint: [ "php", "/usr/src/myapp/main.php", "start" ]

  redis_server:
    build:
      context: ./redis
      args:
        REDIS_VERSION: ${REDIS_VERSION}
    container_name: ${CONTAINER_NAME}-redis
    ports:
      - "${REDIS_HOST_PORT}:6379"
    volumes:
      - ${REDIS_CONF_FILE}:/etc/redis.conf:ro
      - ${DATA_DIR}/redis:/data/:rw
    restart: always
    entrypoint: [ "redis-server", "/etc/redis.conf" ]
    environment:
      TZ: "$TZ"