version: '3.9'

services:
  deepflow-agent:
    container_name: {{ deepflow_agent_container_name }}
    image: {{ deepflow_agent_image }}
    restart: unless-stopped
{% if deepflow_agent_host_network | bool %}
    network_mode: host
{% endif %}
    privileged: true
    environment:
      DEEPFLOW_AGENT_PROFILE: {{ deepflow_agent_profile | to_json }}
{% for key, value in (deepflow_agent_extra_env | default({})).items() %}
      {{ key }}: {{ value | to_json }}
{% endfor %}
    command:
      - "{{ deepflow_agent_endpoint_arg }}"
      - "{{ deepflow_agent_grpc_endpoint }}"
{% if deepflow_agent_disable_pcap | bool %}
      - "--disable-pcap"
{% endif %}
{% if deepflow_agent_disable_vector | bool %}
      - "--disable-vector"
{% endif %}
{% if deepflow_agent_disable_plugins | bool %}
      - "--disable-plugins"
{% endif %}
{% for arg in deepflow_agent_extra_args | default([]) %}
      - "{{ arg }}"
{% endfor %}
    cap_add:
{% for cap in deepflow_agent_cap_add | default([]) %}
      - {{ cap }}
{% endfor %}
    volumes:
{% for mount in deepflow_agent_volume_mounts | default([]) %}
      - {{ mount }}
{% endfor %}
