A powerful CLI tool for building Docker Compose files from modular components. Stackbuilder enables you to create maintainable, scalable Docker environments by assembling base components with environment-specific configurations and optional extensions.
- ๐งฉ Modular Architecture - Compose Docker environments from reusable components
- ๐ Multi-Environment Support - Deploy to development, staging, production with ease
- ๐ Extension System - Add features like monitoring, authentication, logging as needed
- ๐ฏ Named Combos - Define reusable extension combinations for consistency
- ๐ฆ Smart File Management - Intelligent merging of configurations and environment files
- โก Fast Builds - Efficient assembly with intelligent cleanup and preservation
- ๐ง Flexible Configuration - TOML-based configuration with sensible defaults
Get up and running in 3 simple steps:
# 1. Install stackbuilder
cargo install stackbuilder
# 2. Navigate to your project with components
cd your-project
# 3. Build your stack
stackbuilder
Your assembled Docker Compose files will be generated in the ./build
directory!
cargo install stackbuilder
# Using makepkg (see docs/archlinux-packaging.md for details)
cd packaging/archlinux
makepkg -si
git clone https://github.com/zyrakq/stackbuilder.git
cd stackbuilder
cargo build --release
./target/release/stackbuilder --help
Organize your Docker components in this structure:
your-project/
โโโ stackbuilder.toml # Configuration file
โโโ components/
โ โโโ base/ # Core services (required)
โ โ โโโ docker-compose.yml
โ โโโ environments/ # Environment-specific configs
โ โ โโโ dev/
โ โ โ โโโ docker-compose.yml
โ โ โโโ prod/
โ โ โโโ docker-compose.yml
โ โโโ extensions/ # Optional features
โ โโโ monitoring/
โ โ โโโ docker-compose.yml
โ โโโ auth/
โ โโโ docker-compose.yml
โโโ build/ # Generated output (auto-created)
[build]
[build.environments]
available = ["dev", "prod"]
[build.environments.dev]
extensions = ["monitoring", "auth"]
[build.environments.prod]
extensions = ["monitoring", "auth"]
[build]
# Define reusable extension combinations
combos = {
security = ["auth", "guard"],
observability = ["monitoring", "logging"]
}
# New environments API
[build.environments]
available = ["dev", "staging", "prod"]
# Per-environment configurations
[build.environments.dev]
extensions = ["debugging"]
combos = ["security"]
[build.environments.staging]
combos = ["security", "observability"]
[build.environments.prod]
combos = ["security", "observability"]
This repository includes several example configurations:
Simple setup with two environments and authentication extensions:
cd examples/basic
stackbuilder
What it demonstrates:
- Base component with core services
- Two environments:
devcontainer
andinternal
- Extensions:
oidc
andguard
for authentication - Generated structure in
build/
directory
Multi-environment production setup:
cd examples/complex
stackbuilder
What it demonstrates:
- Three environments:
development
,staging
,production
- Multiple extensions:
monitoring
,logging
,auth
,backup
- Environment-specific configurations
- Production-ready deployment structure
Using custom directory structure:
cd examples/custom-paths
stackbuilder
What it demonstrates:
- Custom component directory names
- Non-standard project layout
- Flexible path configuration
Advanced extension management with named combinations:
cd examples/named-combos
stackbuilder
What it demonstrates:
- Named combo definitions
- Reusable extension groups
- Per-environment combo assignments
- Component Assembly - Stackbuilder reads your component structure
- Configuration Parsing - Processes
stackbuilder.toml
for build rules - Docker Compose Merging - Intelligently combines YAML files
- Environment File Merging - Merges
.env.example
files with priority - Additional File Copying - Copies configs, scripts, and certificates
- Smart Cleanup - Preserves existing
.env
files during rebuilds
Stackbuilder is used extensively in practical deployment examples. Check out the docker-stack-collection repository for real-world stack configurations and deployment patterns using stackbuilder.
- Configuration Reference - Complete TOML configuration specification
- Testing Report - Comprehensive test coverage details
We welcome contributions! Please feel free to:
- Report Issues - Found a bug? Open an issue
- Submit PRs - Improvements and new features are welcome
- Share Examples - Add your stackbuilder configurations to help others
- Improve Documentation - Help make our docs even better
This project is dual-licensed under:
You may choose either license for your use.
Built with โค๏ธ in Rust | Perfect for DevOps teams and Docker enthusiasts