Skip to content

Instantly share code, notes, and snippets.

@mohemohe
Created October 13, 2020 07:29
Show Gist options
  • Save mohemohe/7429f869a4d9d4539ef92e89f25e4c63 to your computer and use it in GitHub Desktop.
Save mohemohe/7429f869a4d9d4539ef92e89f25e4c63 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
export AWS_DEFAULT_REGION="$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's|.$||')"
cd /opt/app
TARGET="$(grep image docker-compose.yml | awk '{print $2}')"
aws ecr get-login-password | sudo docker login --username AWS --password-stdin "$TARGET"
sudo docker-compose pull
sudo docker-compose up --force-recreate --remove-orphans -d
sudo docker system prune -af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment