Build

The /cc-deck.build command generates a Containerfile from your manifest and builds the container image. If the build fails, it analyzes the error, fixes the Containerfile, and retries automatically.

Usage

Inside Claude Code in your build directory:

/cc-deck.build

Prerequisites

The build command automatically downloads cc-deck Linux binaries (amd64 + arm64) from GitHub Releases, matching your installed cc-deck version. No manual cross-compilation is needed.

If you are running a development build (version dev), pre-place the binaries manually:

# From the cc-deck source repo
make cross-cli
cp cc-deck/cc-deck-linux-* .cc-deck/image/build-context/

What Happens

  1. Manifest validation: Checks that cc-deck-image.yaml has the required fields

  2. Containerfile generation: Resolves free-form tool descriptions to concrete install commands

  3. Existing file check: If a Containerfile exists, shows a diff and asks whether to use the new or existing version

  4. Build: Runs the container build with a 10-minute timeout

  5. Self-correction: If the build fails, analyzes the error, fixes the Containerfile, and retries (up to 3 times)

  6. build.sh generation: Creates a shell script for rebuilding without Claude Code

Multi-Architecture

By default, images are built for both linux/arm64 and linux/amd64. You can override this in your input:

/cc-deck.build for linux/arm64 only

The Containerfile uses ${TARGETARCH} for architecture-dependent downloads, and the cc-deck binary is copied per-architecture from build-context/cc-deck-linux-${TARGETARCH}.

Self-Correction

When a build step fails, Claude Code:

  1. Reads the error output

  2. Identifies the failing step

  3. Diagnoses the root cause (wrong package name, download URL, permissions, etc.)

  4. Fixes the Containerfile

  5. Retries the build (cached layers are reused)

Common fixes include: * Wrong package names are corrected via dnf search * Download URLs are fixed for the correct architecture

After 3 failed attempts, Claude Code stops and presents the error for manual review.

The build.sh Script

After a successful build, a build.sh script is generated in the build directory. This lets you rebuild the image from the command line without Claude Code:

./build.sh
# or with a specific platform:
PLATFORMS=linux/arm64 ./build.sh

Container Runtime

The build command auto-detects the available container runtime, preferring podman over docker.