Building and Pushing Docker Images
This section describes how to build the Docker images for the services and push them to a Docker registry.
Automated Builds with GitHub Actions
The project is configured to automatically build and push Docker images to a Docker registry whenever code is pushed to the main branch. This process is managed by the GitHub Actions workflow defined in .github/workflows/docker-build.yaml.
The workflow uses the build.sh script to build and push the images.
Secrets
The GitHub Actions workflow requires the following secrets to be configured in the repository settings:
DOCKER_REGISTRY: The URL of the Docker registry.DOCKER_USERNAME: The username for the Docker registry.DOCKER_TOKEN: A personal access token with permissions to push images to the registry.
Manual Builds
You can also build and push the images manually using the build.sh script.
Usage
Prerequisites
Before running the script, you need to:
- Set the
DOCKER_REGISTRYenvironment variable: This variable must be set in your.envfile. It should point to the Docker registry where you want to push the images. - Log in to the Docker registry: You need to be authenticated with the Docker registry. You can do this using the
docker logincommand: - Ensure lock files are present: The script checks for the existence of
uv.lock(for Python services) andpackage-lock.json(for the web service). If these files are missing, you need to generate them by runninguv lockornpm installin the respective service directories.
Script Details
The build.sh script iterates through all the services in the services directory, builds a Docker image for each service, and then pushes the image to the configured Docker registry. It also builds and pushes images for db-prestart, db-backup, shared-data, and grafana.