Skip to content

Instantly share code, notes, and snippets.

@toddlers
Last active June 30, 2022 13:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddlers/3f3a1b54254cdf07165d1bd1ba6bc47e to your computer and use it in GitHub Desktop.
Save toddlers/3f3a1b54254cdf07165d1bd1ba6bc47e to your computer and use it in GitHub Desktop.
bitbucket pipeline with aws credentials
pipelines:
- step:
script:
# assuming the base image which is pulled from ecr has aws cli installed
- export AWS_PROFILE=deployment
# 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