Skip to content

Help for developers: Setting up tools, Procedures, Docker, Kubernetes, Helm...

Notifications You must be signed in to change notification settings

flashflashrevolution/development-tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Development Tutorials

Help for developers: Setting up tools, Procedures, Docker, Kubernetes, Helm...

Docker and Github Container Registry

Assumption: You have docker set up already.

Github Container Registry Authentication

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.

  1. Navigate to Settings / Developer settings / Personal access tokens
  2. Click on "Generate new token.
  3. Name your token docker.
  4. Select:
    • write:packages
    • read:packages
    • delete:packages
  5. Deselect:
    • repo (if it was automatically selected)
  6. Click on "Generate token" at the bottom of the page.
  7. 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

Building and Publishing an Image to a Github Repository

Configuration

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

Building and Publishing

# 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.

About

Help for developers: Setting up tools, Procedures, Docker, Kubernetes, Helm...

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project