Skip to content

Instantly share code, notes, and snippets.

@levynir
Last active June 23, 2019 12:47
Show Gist options
  • Save levynir/ad4fe4c184bcfd61e16d6113b63cfa0e to your computer and use it in GitHub Desktop.
Save levynir/ad4fe4c184bcfd61e16d6113b63cfa0e to your computer and use it in GitHub Desktop.
Script to build a docker for AWS
#!/bin/bash
if [[ $(git diff --stat) != '' ]]; then
echo "*** ERROR *** GIT reports this directory to be dirty.Please commit and push to master before building "; exit 1
fi
APPNAME=dayzz/dayzz-bi
REGION=us-east-2
AWS_CMD=`aws ecr get-login --no-include-email --region $REGION`
AWS_URI=`echo $AWS_CMD | awk '{print $7}' | sed -E "s/https\:\/\///"`
$AWS_CMD
git pull origin master
docker build -t $APPNAME .
docker tag $APPNAME:latest $AWS_URI/$APPNAME
docker push $AWS_URI/$APPNAME
#CC BY (nir at dayzz.com)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment