# calls tools/utils/get_docker_image.py

parameters:
- name: Dockerfile
  type: string
- name: Context
  type: string
- name: DockerBuildArgs
  type: string
  default: ""
- name: Repository
  type: string
- name: UseImageCacheContainerRegistry
  type: boolean
  default: true
- name: UsePipelineCache
  type: boolean
  default: false
- name: ScriptName
  type: string
  default: "tools/utils/get_docker_image.py"
- name: UpdateDepsTxt
  type: boolean
  default: true
- name: IMAGE_CACHE_DIR
  type: string
  default: $(Agent.TempDirectory)/docker

steps:

- script: |
    docker image ls
    docker system df
  displayName: Check Docker Images

- template: with-container-registry-steps.yml
  parameters:
    Steps:
    - script: |
        python ${{ parameters.ScriptName }} \
          --dockerfile "${{ parameters.Dockerfile }}" \
          --context "${{ parameters.Context }}" \
          --docker-build-args "${{ parameters.DockerBuildArgs }}" \
          --container-registry onnxruntimebuildcache \
          --repository "${{ parameters.Repository }}"
      displayName: "Get ${{ parameters.Repository }} image for ${{ parameters.Dockerfile }}"
    ContainerRegistry: onnxruntimebuildcache

