trigger: none

stages:
- stage: LandingImageCreate
  displayName: LandingImageCreate
  jobs:
  - job: CreateAndPush
    pool:
      name: Paynance Docker
    steps:

    - task: Docker@0
      displayName: 'Build an image'
      inputs:
        containerregistrytype: 'Container Registry'
        dockerRegistryConnection: 'PaynanceDocker'
        action: 'Build an image'
        dockerFile: 'Dockerfile'
        imageName: 'paynance/landing:latest'

    - task: Docker@2
      displayName: 'Push an image'
      inputs:
        containerRegistry: 'PaynanceDocker'
        repository: 'Paynance/landing'
        command: 'push'
        tags: 'latest'

    - task: Docker@0
      displayName: 'Destroy local repository'
      inputs:
        containerregistrytype: 'Container Registry'
        dockerRegistryConnection: 'PaynanceDocker'
        action: 'Run a Docker command'
        customCommand: 'system prune -a -f'