Reputation: 868
Trying to Publish my Angular app using Azure DevOps pipeline to AWS ECR. I am new to Azure Pipelines and below is the code I have already managed to write. I have read the docs on Azure pipelines, but struggling to find the neccessary information. Could anyone please assist.
trigger:
- staging-release
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
AWS_REGION: eu-west-1 # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: ******** # set this to your Amazon ECR repository name
ECS_SERVICE: ******** # set this to your Amazon ECS service name
ECS_CLUSTER: ******** # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: ******** # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: ******** # set this to the name of the container in the
# containerDefinitions section of your task definition
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'
tags: |
$(tag)
#Amazon Credentials
- task: AWSCLI@1
inputs:
awsCommand:
- script: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.staging .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
Steps or tasks I need to accomplish:
Upvotes: 1
Views: 357
Reputation: 743
As you are using AWS Toolkit for Azure DevOps, this document: Supply task credentials using a service connection may help you to set up service connection with PAT to supply credentials to the task.
Upvotes: -1