Created
April 6, 2020 01:08
-
-
Save gaulatti/d1dba25777628433305636be324b2001 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
prefix=<account>.dkr.ecr.us-west-2.amazonaws.com | |
region=us-west-2 | |
case $1 in | |
tukwila) | |
repository=tukwila | |
tag=tukwila_i | |
port_inside=3000 | |
port_outside=8080 | |
;; | |
esac | |
if [ -z "$repository" ]; then | |
echo 'Endpoint is not set' | |
else | |
echo "Deploying Tukwila from "$prefix | |
# Docker Login | |
aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $prefix | |
# Docker Pull | |
docker pull $prefix"/"$repository":"$tag | |
# Stop Container | |
docker stop $tag | |
docker kill $tag | |
docker rm $tag | |
# Restart Container | |
echo docker run -d --name $tag -p 127.0.0.1:$port_outside:$port_inside/tcp $prefix/$repository:$tag | |
docker run -d --name $tag -p 127.0.0.1:$port_outside:$port_inside/tcp $prefix/$repository:$tag | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment