Skip to content

Instantly share code, notes, and snippets.

@Kylep342
Last active April 5, 2022 14:27
Show Gist options
  • Save Kylep342/d4769a4922e82a81bf22a894170a065e to your computer and use it in GitHub Desktop.
Save Kylep342/d4769a4922e82a81bf22a894170a065e to your computer and use it in GitHub Desktop.
Small command to atomically build, tag, and push images to a registry
#!/usr/bin/env bash
shipt() {
if [[ $# -ne 3 ]]; then
echo 'Need 3 arguments\n1. Name of local docker tag\n2. Path to local dockerfile\n3. Name of remote docker registry'
else
docker build --tag $1 $2;
docker image tag $1 $3/$1;
docker image push $3/$1;
fi
}
shipt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment