# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '2.1'

services:
  oap:
    extends:
      file: ../../../script/docker-compose/base-compose.yml
      service: oap

  sqrt:
    build:
      context: .
      dockerfile: Dockerfile.sqrt
    networks:
      - e2e

  rover:
    image: "ghcr.io/apache/skywalking-rover/skywalking-rover:${SW_ROVER_COMMIT}"
    networks:
      - e2e
    privileged: true
    pid: host
    environment:
      ROVER_HOST_MAPPING: /host
      ROVER_BACKEND_ADDR: oap:11800
      ROVER_PROCESS_DISCOVERY_HEARTBEAT_PERIOD: 2s
      ROVER_PROCESS_DISCOVERY_VM_ACTIVE: "true"
      ROVER_PROCESS_DISCOVERY_SCAN_MODE: REGEX
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD: sqrt
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LAYER: OS_LINUX
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME: sqrt
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_INSTANCE_NAME: test-instance
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_PROCESS_NAME: "{{.Process.ExeName}}"
      ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LABELS: e2e-label1,e2e-label2
      ROVER_PROFILING_ACTIVE: "true"
      ROVER_PROFILING_CHECK_INTERVAL: 2s
      ROVER_PROFILING_FLUSH_INTERVAL: 5s
      ROVER_PROFILING_TASK_ON_CPU_DUMP_PERIOD: 9ms
    volumes:
      - /:/host

networks:
  e2e: