Skip to content

Instantly share code, notes, and snippets.

@tstrohmeier
Last active September 5, 2022 08:46
Show Gist options
  • Save tstrohmeier/488f42ca7c66372b0c679bbb932c6ca5 to your computer and use it in GitHub Desktop.
Save tstrohmeier/488f42ca7c66372b0c679bbb932c6ca5 to your computer and use it in GitHub Desktop.
AWS ECS: Deploy Docker Container from Bitbucket Pipeline to AWS ECR
# 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
@tstrohmeier
Copy link
Author

Why you push it again with development tag, in docker hub ppl push it with latest 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