openrepo
openrepo copied to clipboard
GH Actions for automatic build and push image
Problem
An automated build is missing from openrepo; it is desired for two reasons:
- make sure that the build is still passing following branch changes, before merge
- have access to images built from branches, so developers can easily run tests with the changes from the branches
- streamlined release process (creating a release/tag automatically builds the image and pushes it to docker hub)
Approach
Create a Github workflow using Docker provided actions to compute the tags, based on branch names and releases, run the build and push to Docker Hub.
A mapping of how the image tags are generated based on git tags and branches can be found here.
The workflow will run for all events (push, tags) except pull_request
.
❗ In order for the Docker Hub push to work, the following must be defined in the repo:
- A repository (⚠️ not environment) variable:
DOCKERHUB_USERNAME
. User for both login to Docker Hub and registry name for tagging - A secret:
DOCKERHUB_TOKEN
- a token generated from Docker Hub with read/write access to the target Hub repository. Used for retrieving info about the registry (by thedocker/metadata-action
action and for pushing the built image - bydocker/build-push-action
The image for this PR is ionnistor/openrepo:inistor-patch-docker-build