Help for developers: Setting up tools, Procedures, Docker, Kubernetes, Helm...
Assumption: You have docker set up already.
To begin we are going to set up a connection to the Github Container Registry.
This will allow you to push newly tagged images to github for use in kubernetes/helm.
If you lose access to docker at any point, follow this guide again.
- Navigate to Settings / Developer settings / Personal access tokens
- Click on "Generate new token.
- Name your token docker.
- Select:
- write:packages
- read:packages
- delete:packages
- Deselect:
- repo (if it was automatically selected)
- Click on "Generate token" at the bottom of the page.
- Remain on this page until you are finished with this tutorial.
# Replace ACCESS_TOKEN with the access token you acquired above.
export CR_PAT=ACCESS_TOKEN
# Replace USERNAME with your github username.
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
If you are building and publishing an image in a repository that has previously had no image, add the following to your Dockerfile.
# Replace REPOSITORY with the name of the repository.
LABEL org.opencontainers.image.source https://github.com/flashflashrevolution/REPOSITORY
# Locate the SHA of the commit you will be basing the image off of.
git log --oneline
# Use the 7 digit SHA as the tag of your new release. Never use latest.
# Replace REPOSITORY with the name of your repository.
docker build -t ghcr.io/flashflashrevolution/REPOSITORY:SHA .
# Double check that you've named it and tagged it correctly.
docker images
# Push the new image using the exact string as you had before.
docker push ghcr.io/flashflashrevolution/REPOSITORY:sha-SHA
Note: Add additional identifiers after REPOSITORY, with a - (myrepo-special), though this will rarely be necessary as there should only be one publishable Dockerfile per repository, and you should be using tags for that.