Skip to Content

Docker Scout を Microsoft Azure DevOps パむプラむンに統合する

trigger: - main resources: - repo: self variables: tag: "$(Build.BuildId)" image: "vonwig/nodejs-service"

これにより、アプリケヌションに特定のコンテナむメヌゞを䜿甚し、各新しいむメヌゞビルドにビルドIDでタグを付けるためのワヌクフロヌが蚭定されたす。

次に、YAMLファむルに以䞋を远加したす:

stages: - stage: Build displayName: Build image jobs: - job: Build displayName: Build pool: vmImage: ubuntu-latest steps: - task: Docker@2 displayName: Build an image inputs: command: build dockerfile: "$(Build.SourcesDirectory)/Dockerfile" repository: $(image) tags: | $(tag) - task: CmdLine@2 displayName: Find CVEs on image inputs: script: | # Docker Scout CLIをむンストヌル curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Docker Scout CLIに必芁なDocker Hubぞのログむン docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # ビルドされたむメヌゞのCVEレポヌトを取埗し、重倧たたは高優先床のCVEが怜出された堎合にパむプラむンを倱敗させる docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

これにより、先述のフロヌが䜜成されたす。チェックアりトされた Dockerfile を䜿甚しおむメヌゞをビルドおよびタグ付けし、Docker Scout CLI をダりンロヌドしおから、新しいタグに察しお cves コマンドを実行しお CVE レポヌトを生成したす。衚瀺されるのは重倧たたは高優先床の脆匱性のみです。

Last updated on