build_images.sh

Build container images using buildah with support for multiple architectures and container engines

Purpose

Build container images using buildah with support for multiple architectures and container engines.

Usage

Usage: ci/build_images.sh [OPTIONS] [GROUP_NAMES...] [-- BUILDAH_ARGS...]

OPTIONS:
    --verbose, -v        Enable verbose output during build
    --arch ARCHITECTURE  Specify target architecture (e.g., amd64, arm64, arm/v7)
    --engine ENGINE      Specify runtime engine for testing/export (podman or docker)
    --setup              Set up Docker-in-Docker environment before exporting
    --component-name NAME
                         Parse component name (format: group--variant--branch)
                         Example: curl--default--main → curl/default
    --local-rpms-dir DIR Directory containing custom RPMs to use during build.
                         These have a higher priority and thus override the
                         standard repositories.
    --only-reverse-deps  Build only reverse dependencies of specified groups
    --include-reverse-deps
                         Build specified groups AND their reverse dependencies
    --help, -h           Show this help message

Examples

# Build single image group (all variants)
ci/build_images.sh nginx
ci/build_images.sh nodejs-20

# Build specific variant only
ci/build_images.sh nginx/builder
ci/build_images.sh nodejs-20/default

# Build multiple image groups at once
ci/build_images.sh nginx curl git
ci/build_images.sh nginx/default curl/builder git/default

# Build with options
ci/build_images.sh --verbose curl
ci/build_images.sh --arch arm64 nginx
ci/build_images.sh --engine docker nginx
ci/build_images.sh --engine podman --verbose nginx

# Build multiple image groups with options
ci/build_images.sh --verbose nginx curl git
ci/build_images.sh --arch arm64 nginx postgresql

# Build only reverse dependencies of core-runtime (e.g., rust, xcaddy)
ci/build_images.sh --only-reverse-deps core-runtime

# Build core-runtime AND its reverse dependencies (useful for local testing)
ci/build_images.sh --include-reverse-deps core-runtime

# Build from CI component name format (used in CI environments)
ci/build_images.sh --component-name curl--default--main

# Build with custom RPMs (for testing modified packages)
ci/build_images.sh --local-rpms-dir ../rpms/builds/hostname/RPMS git/builder

Note: Some images require git submodules initialized (use git init --recurse-submodules when cloning or git submodule update --init if already cloned). When building for foreign architectures, make sure qemu-user-static is available.

Building with custom RPMs

The --local-rpms-dir option enables testing container images with custom-built RPM packages, for iterating on package changes before committing to the RPM repository.

Workflow

  1. Build custom RPMs in the rpms repository (see its documentation for the complete workflow):

    cd ../rpms
    # modify a package
    ci/build_rpms.sh packagename
    # Built RPMs will be in builds/packagename/RPMS/
    
  2. Build container image using the custom RPMs:

    cd ../containers
    ci/build_images.sh --local-rpms-dir ../rpms/builds/packagename/RPMS imagename/builder
    
  3. Verify the custom package was installed:

    podman run --rm --entrypoint '' quay.io/hummingbird/imagename:latest-builder rpm -qa