Skip to content

Instantly share code, notes, and snippets.

@ndamulelonemakh
Last active October 13, 2024 11:14
Show Gist options
  • Save ndamulelonemakh/af5dec1eef63dfbccbb6cdcb2f9f76f5 to your computer and use it in GitHub Desktop.
Save ndamulelonemakh/af5dec1eef63dfbccbb6cdcb2f9f76f5 to your computer and use it in GitHub Desktop.
Convenience script to push images to Github container registry
#!/bin/bash
set -e
# Pre-requisite:
# Generate your token at: https://github.com/settings/tokens/new?scopes=write:packages
# More info: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
export CR_PAT=<YOUR_TOKEN>
GITHUB_USERNAME=<your-github-account-name>
echo $CR_PAT | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin
IMAGE_NAME=<the-name-of-your-image>
docker push ghcr.io/$GITHUB_USERNAME/$IMAGE_NAME:latest
# Access the image at: https://github.com/GITHUB_USERNAME?ecosystem=all&tab=packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment