https://github.com/maresb/simple-ghcr-example
https://github.com/maresb/simple-ghcr-example
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/maresb/simple-ghcr-example
- Owner: maresb
- Created: 2024-07-29T08:57:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T09:04:10.000Z (almost 2 years ago)
- Last Synced: 2025-09-25T23:44:06.668Z (8 months ago)
- Language: Dockerfile
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple GHCR example
Demonstrates how a simple workflow **with no additional configuration/passwords/tokens** is sufficient to publish Docker images to GitHub Container Registry.
Based primarily on the [official instrutions](https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions) which are likely more up-to-date.
## Steps
1. Ensure that you have a `Dockerfile` in the root of the repo, and a workflow file that has been pushed to GitHub.
2. The provided workflow is triggered only by "workflow dispatch". To start a build:
1. Go to the main page of your repo.
2. Click on the "Actions" tab
3. Select "Build Docker image and publish to GHCR" on the left
4. Click the grey "Run workflow" button
5. With the desired branch selected, click the green "Run workflow" button.
The workflow is extremely basic so you will probably want to adapt it to your needs.
The following suggestions are beyond the scope of this simple demonstration:
* Add other build triggers besides "workflow dispatch" by modifying the `on` section.
* Customize the name of the image. (Currently it's the repo name with `-image` as a suffix.)
* Generate tags and other metadata with [docker/metadata-action](https://github.com/docker/metadata-action)
* Enable caching of build layers.
* Set up QEMU if you want to build images for other architectures.
* Test the image before pushing it.
* Push conditionally only on release or tag events, but still build and test on every push.