This repository centralizes all Docker images in one place, simplifying the process of building and pushing Docker images.
The primary goal of this repository is to streamline Docker image management by:
- Gathering all Docker images: Consolidates Dockerfiles into a single repository.
- Automating the build and push process: Uses GitHub Actions to build and push Docker images based on code changes and versions stored in the repo.
Organize your repository as follows to ensure compatibility with the workflow:
/
app1/
Dockerfile
VERSION
app2/
Dockerfile
VERSION
- Each directory (
app1,app2, etc.) should contain aDockerfile. - Each directory must also contain a
VERSIONfile holding the tag you want pushed for that image. - The name of each directory corresponds to the Docker image name.
- The content of the
VERSIONfile is used as the tag forghcr.io/<owner>/<image>:<version>. - Update
VERSIONwhenever you want to publish a new tag for that image; commit the change alongside any Dockerfile or asset updates. - The workflow always publishes a
:latesttag in addition to the version from the file.
- On pushes to
main, the workflow compares the previous and current commits and looks for changed top-level folders that contain aDockerfile(including changes to theirVERSIONfiles). - Only those folders are built and pushed. If nothing relevant changed, the build job is skipped.
- Image metadata is read from the repository itself; commit messages no longer control which images or versions are built.
By following these conventions, Docker images are built and pushed automatically whenever code (or the VERSION file) in an image folder changes. This approach keeps image versions in the codebase and simplifies Docker image management.
For more information on GitHub Actions and Docker, check out the GitHub Actions documentation and Docker documentation.