Created
September 23, 2021 01:08
-
-
Save subudear/1fecae15c90e1f13d191ca8987f50b7c to your computer and use it in GitHub Desktop.
Azure pipeline to push image to AWS ECR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: | |
- master | |
pool: | |
name: Self-Hosted-Agent | |
variables: | |
- group: dev | |
steps: | |
- task: Go@0 | |
displayName: "Go Get" | |
inputs: | |
command: 'get' | |
arguments: '-d' | |
workingDirectory: '$(System.DefaultWorkingDirectory)' | |
- task: Go@0 | |
displayName: "Go Build" | |
inputs: | |
command: 'build' | |
workingDirectory: '$(System.DefaultWorkingDirectory)' | |
- task: CopyFiles@2 | |
inputs: | |
SourceFolder: '$(System.DefaultWorkingDirectory)' | |
Contents: 'deployment.yaml' | |
TargetFolder: '$(Build.ArtifactStagingDirectory)' | |
- task: PublishBuildArtifacts@1 | |
inputs: | |
artifactName: drop | |
- task: Docker@2 | |
displayName: Build an image | |
inputs: | |
command: build | |
dockerfile: '$(System.DefaultWorkingDirectory)/Dockerfile' | |
buildContext: '$(System.DefaultWorkingDirectory)' | |
repository: $(AWS_ECR_MAGE_URI) | |
- task: ECRPushImage@1 | |
inputs: | |
awsCredentials: 'AWS_Service' | |
regionName: $(AWS_REGION) | |
imageSource: 'imagename' | |
sourceImageName: $(AWS_ECR_MAGE_URI) | |
sourceImageTag: $(Build.BuildId) | |
pushTag: $(Build.BuildId) | |
repositoryName: $(AWS_ECR_REPOSITORY_NAME) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment