Last active
September 5, 2022 08:46
-
-
Save tstrohmeier/488f42ca7c66372b0c679bbb932c6ca5 to your computer and use it in GitHub Desktop.
AWS ECS: Deploy Docker Container from Bitbucket Pipeline 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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mhewedy Because I use for every branch a own tag. I use
development
tag for the latest build ofdevelopment
branch.