Skip to content

Instantly share code, notes, and snippets.

@christopher-caldwell
Created April 29, 2021 23:26
Show Gist options
  • Save christopher-caldwell/f6ba14aa9fd054789ae0cfb194be70c7 to your computer and use it in GitHub Desktop.
Save christopher-caldwell/f6ba14aa9fd054789ae0cfb194be70c7 to your computer and use it in GitHub Desktop.
Deploying a Docker container to ECR
#!/bin/sh
Red="\033[0;31m" # Red
Green="\033[0;32m" # Green
BICyan="\033[1;96m" # Bold Cyan
# Reset
Color_Off="\033[0m" # Text Reset
printf "\n\n$BICyan$( echo Deploying the Docker container )$Color_Off"
printf "\n\n"
FILE_PATH=../../../ui/
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws ecr get-login-password \
--region us-east-1 \
| docker login \
--username AWS \
--password-stdin $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com
docker build -t $REPOSITORY_NAME:$IMAGE_TAG $FILE_PATH
docker tag $REPOSITORY_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/$REPOSITORY_NAME:$IMAGE_TAG
docker push $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/$REPOSITORY_NAME:$IMAGE_TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment