services:
  apidoc:
    image: swaggerapi/swagger-ui
    container_name: ${APIDOC_CONTAINER_NAME}
    restart: always
    entrypoint:
      [
        "/bin/sh",
        "-c",
        "sed -i 's|localhost:${API_INNTER_PORT}|${SWAGGER_INVOKE_URL}|g' ${SWAGGER_JSON} && /docker-entrypoint.sh nginx && tail -f /dev/null",
      ]
    ports:
      - "${APIDOC_PORT_DEFINE}:8080"
    environment:
      SWAGGER_JSON: ${SWAGGER_JSON}
      APIDOC_CONTAINER_NAME: ${APIDOC_CONTAINER_NAME}
      APIDOC_PORT: ${APIDOC_PORT}
      INVOKE_URL: ${SWAGGER_INVOKE_URL}
      API_URL: https://${DOMAIN}/${SERVICE_NAME}-${APIDOC_BUILD_SUFFIX}/${SERVICE_NAME}.json
    volumes:
      - ${HOST_APIDOC_DIRCTORY}:${APIDOC_CONTAINER_DIRECOTRY}

networks:
  default:
    name: ${DOCKER_NETWORK_NAME}
    external: true
