Skip to content

Instantly share code, notes, and snippets.

@devfire
Last active July 23, 2020 06:48
Show Gist options
  • Save devfire/0ce1229292f2b6aa9a81ced818cd78b6 to your computer and use it in GitHub Desktop.
Save devfire/0ce1229292f2b6aa9a81ced818cd78b6 to your computer and use it in GitHub Desktop.
aws ecr login
#!/bin/bash
set -e
REPO_NAME=$1
ECR_URL=31415926.dkr.ecr.us-east-1.amazonaws.com
if [ $# -ne 1 ]; then
echo $0: usage: $0 REPO_NAME
exit 1
fi
eval $(aws ecr get-login --region us-east-1 --no-include-email | sed 's|https://||')
docker build -t "$REPO_NAME" .
docker tag "$REPO_NAME":latest "$ECR_URL"/"$REPO_NAME":latest
docker push "$ECR_URL"/"$REPO_NAME":latest
@jozenstar
Copy link

Consider using this shortcut instead of eval
aws ecr get-login --region us-east-1 --no-include-email | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment