---
version: 3

images:
  base_image:
    name: {{ ee_base_image }}
{%- if ee_build_arg_defaults %}

build_arg_defaults:
{%- for key, val in ee_build_arg_defaults | dictsort %}
  {{ key }}: {{ val | json }}
{%- endfor %}
{%- endif %}

dependencies:
{%- if not is_official_ee %}
  # Use python3
  python_interpreter:
    package_system: python3
    python_path: {{ ee_python_path }}

  ansible_core:
    package_pip: ansible-core

  ansible_runner:
    package_pip: ansible-runner
{%- else %}
  python_interpreter:
    python_path: {{ ee_python_path }}
{%- endif %}
{%- if ee_system_packages %}

  system:
{%- for pkg in ee_system_packages %}
    - {{ pkg }}
{%- endfor %}
{%- endif %}
{%- if ee_python_deps %}

  python:
{%- for dep in ee_python_deps %}
    - {{ dep }}
{%- endfor %}
{%- endif %}
{%- if ee_collections %}

  galaxy:
    collections:
{%- for col in ee_collections %}
      - name: {{ col.name }}
{%- if col.version is defined %}
        version: "{{ col.version }}"
{%- endif %}
{%- if col.type is defined %}
        type: {{ col.type }}
{%- endif %}
{%- if col.source is defined %}
        source: {{ col.source }}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- if ee_additional_build_files %}

additional_build_files:
{%- for file in ee_additional_build_files %}
  - src: {{ file.src }}
    dest: {{ file.dest }}
{%- endfor %}
{%- endif %}
{%- if not is_official_ee or ee_galaxy_token_vars or ee_additional_build_steps %}

additional_build_steps:
{%- if ee_additional_build_steps.prepend_base is defined %}
  prepend_base:
{%- for step in ee_additional_build_steps.prepend_base %}
    - {{ step }}
{%- endfor %}
{%- endif %}
{%- if ee_galaxy_token_vars or ee_additional_build_steps.prepend_galaxy is defined %}
  prepend_galaxy:
{%- for var in ee_galaxy_token_vars %}
    - ARG {{ var }}
{%- endfor %}
{%- if ee_additional_build_steps.prepend_galaxy is defined %}
{%- for step in ee_additional_build_steps.prepend_galaxy %}
    - {{ step }}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if not is_official_ee or ee_additional_build_steps.append_base is defined %}
  append_base:
{%- if not is_official_ee %}
    - RUN $PYCMD -m pip install -U pip
{%- endif %}
{%- if ee_additional_build_steps.append_base is defined %}
{%- for step in ee_additional_build_steps.append_base %}
    - {{ step }}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if ee_additional_build_steps.prepend_final is defined %}
  prepend_final:
{%- for step in ee_additional_build_steps.prepend_final %}
    - {{ step }}
{%- endfor %}
{%- endif %}
{%- if ee_additional_build_steps.append_final is defined %}
  append_final:
{%- for step in ee_additional_build_steps.append_final %}
    - {{ step }}
{%- endfor %}
{%- endif %}
{%- endif %}

options:
{%- if ee_options.package_manager_path is defined %}
  package_manager_path: {{ ee_options.package_manager_path }}
{%- endif %}
{%- if not (is_official_ee and ee_name_is_default) %}
  tags:
    - {{ ee_name }}
{%- endif %}
