Last active
September 5, 2022 08:46
AWS ECS: Deploy Docker Container from Bitbucket Pipeline to AWS ECR
This file contains hidden or 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
# enable Docker for your repository | |
options: | |
docker: true | |
pipelines: | |
branches: | |
development: | |
- step: | |
#python image with aws-cli installed | |
image: tstrohmeier/awscli:3.8.3 | |
script: | |
# aws login | |
- eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
# docker | |
- export BUILD_ID=$BITBUCKET_BRANCH_$BITBUCKET_COMMIT_$BITBUCKET_BUILD_NUMBER | |
- docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
- docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
- docker tag ${AWS_REGISTRY_URL}:$BUILD_ID ${AWS_REGISTRY_URL}:development | |
- docker push ${AWS_REGISTRY_URL}:development |
Why you push it again with
development
tag, in docker hub ppl push it withlatest
tag instead?
@mhewedy Because I use for every branch a own tag. I use development
tag for the latest build of development
branch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mistillate Yes you are right,
aws-cli
needs to be installed in the image you are using.In Line 10/11 of the Gist, I mentioned this: