debian-atomic/justfile
robojerk a207949d9f Add comprehensive documentation and improve container configuration
- Add technical report on Debian atomic image creation
- Add Fedora tools bootable instructions and implementation report
- Add apt-tool blocking implementation documentation
- Add environment configuration example
- Update .gitignore with better artifact blocking
- Update justfile and Containerfile configurations
- Improve variants configuration for debian-bootc-base
2025-08-19 20:51:01 -07:00

377 lines
16 KiB
Makefile

# Debian Atomic Justfile
# 1:1 parallel to Fedora Atomic for Debian
# Based on workstation-ostree-config patterns
# Load environment variables from .env file
set dotenv-load
# Default recipe - show available commands
default:
@echo "Debian Atomic Build System"
@echo "=========================="
@echo ""
@echo "Available recipes:"
@echo " compose-base - Compose base OSTree image (Debian 13 Trixie)"
@echo " compose-base-forky - Compose base OSTree image (Debian 14 Forky)"
@echo " compose-variants - Compose all variants (Debian 13 Trixie)"
@echo " compose-variants-forky - Compose all variants (Debian 14 Forky)"
@echo " compose-testing - Build testing variant (bootc, apt-ostree, bootupd)"
@echo " compose-workstation - Build workstation variant (GNOME)"
@echo " compose-server - Build server variant (CLI)"
@echo " compose-debian-bootc-base - Build Debian bootc base image"
@echo " build-iso - Build bootable ISO images using bootc-image-builder container"
@echo " build-qcow2 - Build bootable QCOW2 images using bootc-image-builder container"
@echo " build-all-images - Build all image formats (ISO, QCOW2, raw)"
@echo " sync-packages - Sync with Debian package groups"
@echo " test-variant - Test a specific variant"
@echo " clean - Clean build artifacts"
@echo " deploy - Deploy to container registry"
@echo " push-variant - Push specific variant to registry for image building"
@echo " push-all - Push all variants to registry for image building"
@echo " login - Login to registry using .env credentials"
@echo " logout - Logout from registry"
@echo ""
@echo "Examples:"
@echo " just compose-base"
@echo " just compose-testing"
@echo " just compose-variants"
@echo " just login # Login to registry first"
@echo " just push-variant base"
@echo " just build-iso variant=base output=./output"
@echo " just test-variant variant=testing"
# Variables
variant := "base"
output_dir := "./output"
registry := env_var_or_default("REGISTRY_URL", "git.raines.xyz/robojerk")
registry_username := env_var_or_default("REGISTRY_USERNAME", "robojerk")
registry_password := env_var_or_default("REGISTRY_PASSWORD", "")
compose_type := "image" # image (OCI container approach)
# Login to registry using .env credentials
login:
@echo "Logging in to registry {{registry}}..."
@if [ -z "{{registry_password}}" ]; then \
echo "Error: REGISTRY_PASSWORD not set in .env file"; \
echo "Please create a .env file with your registry credentials"; \
exit 1; \
fi
@echo "{{registry_password}}" | podman login {{registry}} --username {{registry_username}} --password-stdin
@echo "Successfully logged in to {{registry}}"
# Logout from registry
logout:
@echo "Logging out from registry {{registry}}..."
podman logout {{registry}}
@echo "Successfully logged out from {{registry}}"
# Compose base OSTree image (Debian 13 Trixie Stable)
compose-base:
@echo "Composing Debian Atomic Base (Trixie Stable)..."
@mkdir -p {{output_dir}}/base
cd variants/base && \
podman build -t debian-atomic-base:latest . && \
echo "Base image (Trixie) composed successfully"
# Compose base OSTree image (Debian 14 Forky Testing)
compose-base-forky:
@echo "Composing Debian Atomic Base (Forky Testing)..."
@mkdir -p {{output_dir}}/base-forky
cd variants/base-forky && \
podman build -t debian-atomic-base-forky:latest . && \
echo "Base image (Forky) composed successfully"
# Compose all variants
compose-variants: compose-base
@echo "Composing all Debian Atomic variants..."
@mkdir -p {{output_dir}}/variants
for variant_dir in variants/*/; do \
if [ -f "$$variant_dir/Containerfile" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Composing $$variant_name..."; \
cd "$$variant_dir" && \
podman build -t debian-atomic-$$variant_name:latest . && \
cd ../..; \
fi; \
done
@echo "All variants composed successfully"
# Compose workstation variant (GNOME desktop)
compose-workstation: compose-base
@echo "Composing Debian Atomic Workstation variant..."
@mkdir -p {{output_dir}}/workstation
cd variants/workstation && \
podman build -t debian-atomic-workstation:latest . && \
echo "Workstation variant composed successfully"
# Compose server variant (CLI server)
compose-server: compose-base
@echo "Composing Debian Atomic Server variant..."
@mkdir -p {{output_dir}}/server
cd variants/server && \
podman build -t debian-atomic-server:latest . && \
echo "Server variant composed successfully"
# Build testing variant with Debian Atomic components
compose-testing: compose-debian-bootc-base
@echo "Composing Debian Atomic Testing variant..."
@mkdir -p {{output_dir}}/testing
cd variants/testing && \
podman build -t debian-atomic-testing:latest . && \
echo "Testing variant composed successfully"
# Build Debian bootc base image
compose-debian-bootc-base:
@echo "Building Debian bootc base image..."
cd variants/debian-bootc-base && \
podman build -t debian-atomic-debian-bootc-base:latest . && \
echo "Debian bootc base image built successfully"
# Build all variants in one command
build-all: compose-base compose-debian-bootc-base compose-workstation compose-server compose-testing
@echo "All Debian Atomic variants built successfully"
# Push specific variant to registry for image building
push-variant variant:
@echo "Pushing {{variant}} variant to registry {{registry}}..."
@echo "This step is required before building bootable images with bootc-image-builder"
@echo "Make sure you're logged in: just login"
podman tag debian-atomic-{{variant}}:latest {{registry}}/{{variant}}:latest
podman push {{registry}}/{{variant}}:latest
@echo "{{variant}} variant pushed to {{registry}}/{{variant}}:latest"
@echo "You can now use: just build-qcow2 {{variant}} ./output"
# Push all variants to registry for image building
push-all:
@echo "Pushing all variants to registry {{registry}}..."
@echo "Make sure you're logged in: just login"
just push-variant base
just push-variant debian-bootc-base
just push-variant workstation
just push-variant server
just push-variant testing
@echo "All variants pushed to registry {{registry}}"
@echo "You can now build bootable images for any variant"
# Build bootable ISO images using bootc-image-builder container
build-iso variant output_path:
@echo "Building bootable ISO for {{variant}} variant..."
@echo "Using bootc-image-builder container tool..."
@echo "Note: Variant must be pushed to registry first using: just push-variant {{variant}}"
@mkdir -p {{output_path}}
@echo "Pulling bootc-image-builder container if not present..."
@podman pull quay.io/centos-bootc/bootc-image-builder:latest
@echo "Creating ISO image..."
sudo podman run --rm -it --privileged \
--security-opt label=type:unconfined_t \
-v {{output_path}}:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
quay.io/centos-bootc/bootc-image-builder:latest \
--type iso \
--output /output \
{{registry}}/{{variant}}:latest
@echo "ISO image created successfully in {{output_path}}"
# Build bootable QCOW2 images using bootc-image-builder container
build-qcow2 variant output_path:
@echo "Building bootable QCOW2 for {{variant}} variant..."
@echo "Using bootc-image-builder container tool..."
@echo "Note: Variant must be pushed to registry first using: just push-variant {{variant}}"
@mkdir -p {{output_path}}
@echo "Pulling bootc-image-builder container if not present..."
@podman pull quay.io/centos-bootc/bootc-image-builder:latest
@echo "Creating QCOW2 image..."
sudo podman run --rm -it --privileged \
--security-opt label=type:unconfined_t \
-v {{output_path}}:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
quay.io/centos-bootc/bootc-image-builder:latest \
--type qcow2 \
--output /output \
{{registry}}/{{variant}}:latest
@echo "QCOW2 image created successfully in {{output_path}}"
# Build all image formats (ISO, QCOW2, raw) using bootc-image-builder container
build-all-images variant output_path:
@echo "Building all image formats for {{variant}} variant..."
@echo "Using bootc-image-builder container tool..."
@echo "Note: Variant must be pushed to registry first using: just push-variant {{variant}}"
@mkdir -p {{output_path}}
@echo "Pulling bootc-image-builder container if not present..."
@podman pull quay.io/centos-bootc/bootc-image-builder:latest
@echo "Creating ISO, QCOW2, and raw images..."
sudo podman run --rm -it --privileged \
--security-opt label=type:unconfined_t \
-v {{output_path}}:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
quay.io/centos-bootc/bootc-image-builder:latest \
--type iso,qcow2,raw \
--output /output \
{{registry}}/{{variant}}:latest
@echo "All image formats created successfully in {{output_path}}"
# Sync with Debian package groups (Fedora comps-sync equivalent)
sync-packages:
@echo "Syncing with Debian package groups..."
python3 scripts/comps-sync.py treefiles/tasks.yaml
@echo "Package groups synced successfully"
# Test a specific variant
test-variant variant:
@echo "Testing {{variant}} variant..."
@mkdir -p {{output_dir}}/test
if [ -d "variants/{{variant}}" ]; then \
cd variants/{{variant}} && \
podman build -t debian-atomic-{{variant}}:test . && \
echo "{{variant}} variant test build successful" && \
cd ../..; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Test all variants
test-all-variants: compose-variants
@echo "Testing all variants..."
for variant_dir in variants/*/; do \
if [ -f "$$variant_dir/Containerfile" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Testing $$variant_name..."; \
just test-variant variant=$$variant_name; \
fi; \
done
@echo "All variants tested successfully"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@podman rmi -f debian-atomic-base:latest 2>/dev/null || true
@podman rmi -f debian-atomic-base-forky:latest 2>/dev/null || true
@podman rmi -f debian-atomic-workstation:latest 2>/dev/null || true
@podman rmi -f debian-atomic-server:latest 2>/dev/null || true
@podman rmi -f debian-atomic-testing:latest 2>/dev/null || true
@podman rmi -f debian-atomic-debian-bootc-base:latest 2>/dev/null || true
@rm -rf {{output_dir}}
@echo "Cleanup completed"
# Deploy to container registry
deploy:
@echo "Deploying to registry {{registry}}..."
@echo "Make sure you're logged in: just login"
podman tag debian-atomic-base:latest {{registry}}/base:latest
podman push {{registry}}/base:latest
for variant_dir in variants/*/; do \
if [ -d "$$variant_dir" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Deploying $$variant_name..."; \
podman tag debian-atomic-$$variant_name:latest {{registry}}/$$variant_name:latest; \
podman push {{registry}}/$$variant_name:latest; \
fi; \
done
@echo "Deployment completed"
# Deploy specific variant
deploy-variant variant:
@echo "Deploying {{variant}} variant to {{registry}}..."
@echo "Make sure you're logged in: just login"
if [ -d "variants/{{variant}}" ]; then \
podman tag debian-atomic-{{variant}}:latest {{registry}}/{{variant}}:latest; \
podman push {{registry}}/{{variant}}:latest; \
echo "{{variant}} variant deployed successfully"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Build and deploy in one command
build-deploy variant:
@echo "Building and deploying {{variant}} variant..."
just compose-{{variant}}
just deploy-variant variant={{variant}}
# Validate variant configuration
validate variant:
@echo "Validating {{variant}} variant configuration..."
if [ -d "variants/{{variant}}" ]; then \
if [ -f "variants/{{variant}}/Containerfile" ]; then \
echo "✓ Containerfile found"; \
else \
echo "✗ Containerfile missing"; \
exit 1; \
fi; \
echo "{{variant}} variant validation completed"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Validate all variants
validate-all:
@echo "Validating all variants..."
for variant_dir in variants/*/; do \
if [ -d "$$variant_dir" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Validating $$variant_name..."; \
just validate variant=$$variant_name; \
fi; \
done
@echo "All variants validated successfully"
# Show variant status
status:
@echo "Debian Atomic Variant Status"
@echo "============================"
@echo "Base images:"
@bash -c 'if podman images | grep -q "debian-atomic-base"; then echo " base: ✓ Built"; else echo " base: ✗ Not built"; fi'
@bash -c 'if podman images | grep -q "debian-atomic-base-forky"; then echo " base-forky: ✓ Built"; else echo " base-forky: ✗ Not built"; fi'
@bash -c 'if podman images | grep -q "debian-atomic-debian-bootc-base"; then echo " debian-bootc-base: ✓ Built"; else echo " debian-bootc-base: ✗ Not built"; fi'
@echo ""
@echo "Variants:"
@bash -c 'for variant in base workstation server testing debian-bootc-base; do if podman images | grep -q "debian-atomic-$variant"; then echo " $variant: ✓ Built"; else echo " $variant: ✗ Not built"; fi; done'
@echo ""
@echo "Registry Status:"
@echo " Registry: {{registry}}"
@echo " Username: {{registry_username}}"
@echo " Note: Use 'just login' to authenticate, then 'just push-variant <variant>' to push variants"
# Help recipe
help:
@echo "Debian Atomic Build System Help"
@echo "==============================="
@echo ""
@echo "This justfile provides Fedora Atomic 1:1 parallel build recipes for Debian Atomic."
@echo ""
@echo "Key Concepts:"
@echo " - compose-base: Build base Debian images"
@echo " - compose-variants: Build all variants"
@echo " - compose-debian-bootc-base: Build bootc-compatible base image"
@echo " - sync-packages: Sync with Debian package groups"
@echo " - login: Authenticate with registry using .env credentials"
@echo " - push-variant: Push variant to registry for image building"
@echo " - build-iso: Create bootable ISO using bootc-image-builder container"
@echo " - build-qcow2: Create bootable QCOW2 using bootc-image-builder container"
@echo " - build-all-images: Create all image formats (ISO, QCOW2, raw)"
@echo ""
@echo "Complete Workflow for Bootable Images:"
@echo " 1. just login # Authenticate with registry"
@echo " 2. just compose-base # Build base image"
@echo " 3. just compose-debian-bootc-base # Build bootc base"
@echo " 4. just compose-variants # Build all variants"
@echo " 5. just push-variant base # Push to registry"
@echo " 6. just build-qcow2 base ./output # Create bootable QCOW2"
@echo " 7. just deploy # Deploy to registry"
@echo ""
@echo "Security:"
@echo " - Create a .env file with your registry credentials"
@echo " - Use 'just login' to authenticate securely"
@echo " - Use 'just logout' when done"
@echo ""
@echo "Image Creation (requires registry push first):"
@echo " - just login # Authenticate first"
@echo " - just push-variant <variant> # Push variant to registry"
@echo " - just build-iso <variant> <output_path> # Create bootable ISO"
@echo " - just build-qcow2 <variant> <output_path> # Create bootable QCOW2"
@echo " - just build-all-images <variant> <output_path> # Create all formats"
@echo ""
@echo "For more information, see the Debian Atomic documentation."