Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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