Dockerizing DevOps V2 - AzDO 컨테이너 작업

container jobs과 함께 step targeting을 사용하여 AzDO 내에서 컨테이너를 실행하는 더 좋은 방법을 발견했기 때문에 이것은 내 이전 블로그 게시물에 대한 후속 조치입니다.

trigger: none

resources:
  containers:
    - container: devcontainer
      image: $(imageRepository):$(Build.BuildId)
      endpoint: demoacr
      options: --name devcontainer

variables:
  - name: dockerRegistryServiceConnection
    value: "demoserviceconnection"
  - name: imageRepository
    value: "demoacr.azurecr.io/foo-devcontainer"

stages:
  - stage: BUILD
    displayName: Docker build & push
    jobs:
      - job:
        displayName: Devcontainer build & push
        steps:
          - task: Docker@2
            displayName: Login to ACR
            inputs:
              command: login
              containerRegistry: $(dockerRegistryServiceConnection)

          - task: Docker@2
            displayName: Build and push an image to container registry
            inputs:
              command: buildAndPush
              repository: $(imageRepository)
              dockerfile: ".devcontainer/Dockerfile"
              containerRegistry: $(dockerRegistryServiceConnection)
              tags: |
                $(Build.BuildId)
                latest

  - stage: TEST
    displayName: Run tests and linters
    dependsOn:
      - BUILD
    jobs:
      - job: Tests
        steps:
          - task: Docker@2
            displayName: Login to ACR
            inputs:
              command: login
              containerRegistry: $(dockerRegistryServiceConnection)

          - script: |
              make lint
            displayName: "Lint"
            target: devcontainer

          - script: |
              make test
            displayName: "Run all tests"
            target: devcontainer

좋은 웹페이지 즐겨찾기