Created
January 2, 2024 13:21
-
-
Save WesselAtWork/9f3d66a7bae302af4ffca949d3f51b2b to your computer and use it in GitHub Desktop.
Logs In Ephemerally and then pulls [ARGS] images from ECR. Assumes all [ARGS] can use the same creds as the 1st ARG.
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 | |
| URL="$1" | |
| REGISTRY="${URL%/*}" | |
| pre="${REGISTRY%.amazonaws.com}" | |
| AWS_REGION="${pre##*.}" | |
| HOME="." | |
| export HOME | |
| aws ecr get-login-password --region "$AWS_REGION" | oras login --username AWS --password-stdin "$REGISTRY" | |
| printf '%s\0' "$@" | xargs -n1 --null oras pull | |
| unset HOME | |
| rm -rf .docker .containers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment