Docker Bake - mitre/heimdall2 GitHub Wiki
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.shinstead.
-
Docker Desktop (macOS/Windows) or Docker Engine (Linux)
- Version 4.x or later (includes buildx)
- Docker Desktop: Download for macOS/Windows
- Docker Engine for Linux: Installation guide
-
Verify buildx is available:
docker buildx version # Should output: github.com/docker/buildx v0.x.x -
Check available builders:
docker buildx ls
# Build for both amd64 and arm64 architectures
docker buildx bake server# Build for both amd64 and arm64 architectures
docker buildx bake lite# Build both server and lite
docker buildx bake default
# Or explicitly
docker buildx bake server lite| 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 |
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-testIf 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).
Override the Red Hat UBI base image:
docker buildx bake server \
--set "*.args.BASE_CONTAINER=node:22-alpine"Use a different npm registry (useful behind corporate firewalls):
docker buildx bake server \
--set "*.args.YARNREPO_MIRROR=https://registry.your-company.com"# 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 and export at
docker buildx bake server \
--set "*.output=type=docker,dest=./heimdall.tar"If you have access to the MITRE Docker Build Cloud:
# Create a cloud builder
docker buildx create --driver cloud mitre/mitre-builder --name cloud
# Use it
docker buildx use cloud# Now all builds use native ARM in the cloud (fast!)
docker buildx bake server
# Build time: ~10 minutes instead of 60# Use default builder (QEMU emulation)
docker buildx use default
# Builds use local QEMU again
docker buildx bake serverWithout changing your default builder:
# Just for this build, use cloud
docker buildx bake --builder cloud serverAll build targets are defined in docker-bake.hcl at the repository root.