Docker Bake - mitre/heimdall2 GitHub Wiki

Building Heimdall Images Locally with Docker Bake

This guide shows developers how to build Heimdall Server and Heimdall Lite Docker images from source using Docker Bake.

Note: This is for developers who want to build custom images or test changes. If you just want to run Heimdall using pre-built images, see the README's Docker setup instructions and use ./setup-docker-env.sh instead.

Prerequisites

  1. Docker Desktop (macOS/Windows) or Docker Engine (Linux)

  2. Verify buildx is available:

    docker buildx version
    # Should output: github.com/docker/buildx v0.x.x
  3. Check available builders:

    docker buildx ls

Quick Start

Build Heimdall Server (Full Stack)

# Build for both amd64 and arm64 architectures
docker buildx bake server

Build Heimdall Lite (Frontend Only)

# Build for both amd64 and arm64 architectures
docker buildx bake lite

Build Everything

# Build both server and lite
docker buildx bake default

# Or explicitly
docker buildx bake server lite

Available Build Targets

Target What It Builds Platforms Use Case
server Full Heimdall (backend + frontend) amd64 + arm64 Multi-platform build (default)
lite Frontend-only static site amd64 + arm64 Multi-platform build (default)
server-amd64 Full Heimdall amd64 only Single-architecture build
server-arm64 Full Heimdall arm64 only Single-architecture build
lite-amd64 Frontend-only amd64 only Single-architecture build
lite-arm64 Frontend-only arm64 only Single-architecture build

Advanced Usage

Custom Image Tags

Control the tags applied to built images:

# Add a custom tag suffix (e.g., git commit SHA)
export TAG_SUFFIXES=$(git rev-parse HEAD)
docker buildx bake server
# Results in: mitre/heimdall2:<commit-sha>

# Add several custom tag suffixes - comma-delimited list
export TAG_SUFFIXES="$(git rev-parse HEAD),dev-test"
docker buildx bake server
# Results in: mitre/heimdall2:<commit-sha> AND mitre/heimdall2:dev-test

If TAG_SUFFIXES is unset, the image will not be tagged with a human-friendly name (but can still be referenced by the raw image ID).

Custom Base Container

Override the Red Hat UBI base image:

docker buildx bake server \
  --set "*.args.BASE_CONTAINER=node:22-alpine"

Custom Yarn Mirror

Use a different npm registry (useful behind corporate firewalls):

docker buildx bake server \
  --set "*.args.YARNREPO_MIRROR=https://registry.your-company.com"

Build and Push to Your Registry

# Login first
docker login

# Build and push multi-platform image
docker buildx bake server --push

# Or to a custom registry
docker buildx bake server \
  --set DOCKER_HUB_REPO=your-registry.com/heimdall2 \
  --push

Build a Local Image Export (tarball)

# build and export at 
docker buildx bake server \
  --set "*.output=type=docker,dest=./heimdall.tar"

Using Docker Build Cloud (Fast Builds)

If you have access to the MITRE Docker Build Cloud:

One-Time Setup

# Create a cloud builder
docker buildx create --driver cloud mitre/mitre-builder --name cloud

# Use it
docker buildx use cloud

Build with Build Cloud

# Now all builds use native ARM in the cloud (fast!)
docker buildx bake server

# Build time: ~10 minutes instead of 60

Switch Back to Local

# Use default builder (QEMU emulation)
docker buildx use default

# Builds use local QEMU again
docker buildx bake server

One-Off Build Cloud Build

Without changing your default builder:

# Just for this build, use cloud
docker buildx bake --builder cloud server

Build Configuration File

All build targets are defined in docker-bake.hcl at the repository root.

⚠️ **GitHub.com Fallback** ⚠️