- Created:
include/docker_cpp/version.hh- Semantic versioning constants (MAJOR: 0, MINOR: 1, PATCH: 0)
- Version string: "0.1.0"
- Utility functions for version info
- Location:
include/docker_cpp/version.hh
- Updated:
CMakeLists.txt- Removed hardcoded
set(CMAKE_BUILD_TYPE Debug) - Added
CMAKE_BUILD_TYPEoption (defaults to Release) - Added
BUILD_SHARED_LIBSoption (defaults to ON) - Added
BUILD_TESTSoption (defaults to ON) - Added version variables for semantic versioning
- Added HOMEPAGE_URL
- Changes:
- Build type now configurable per platform
- Shared library builds enabled by default (needed for system packages)
- Tests can be disabled for package builds
- Removed hardcoded
- Updated:
src/CMakeLists.txt- Set
VERSIONproperty (0.1.0) - Set
SOVERSIONproperty (0) - Configured library installation targets
- Result: Produces
libdocker_cpp_client.so.0(SOVERSION-based naming)
- Set
- Updated:
CMakeLists.txtwith install() directives:- Headers installed to
include/ - Library installed to
lib/ - CMake config files to
lib/cmake/docker_cpp/ - pkg-config file to
lib/pkgconfig/
- Headers installed to
- Created:
docker_cpp.pc.intemplate- Provides
pkg-config --cflags --libs docker_cppcapability - Automatically generated and installed
- Usage: Downstream projects can use pkg-config to find libraries
- Provides
- Created:
docker_cppConfig.cmake.in- Enables
find_package(docker_cpp)for downstream projects - Exports targets as
docker_cpp::docker_cpp - Declares dependencies (Boost, CURL, spdlog)
- Enables
debian/control
- Binary packages:
libdocker-cpp0(runtime) andlibdocker-cpp-dev(development) - Build dependencies specified
- Proper dependencies between packages
- maintainer email placeholder (update as needed)
debian/rules
- Build configuration with hardening flags
- Release build type (
-DCMAKE_BUILD_TYPE=Release) - Tests disabled for packages
- Shared library build enabled
debian/libdocker-cpp0.install
- Runtime library with SOVERSION:
/usr/lib/*/libdocker_cpp_client.so.*
debian/libdocker-cpp-dev.install
- Headers:
/usr/include/ - Static and shared library links:
/usr/lib/*/libdocker_cpp_client.* - pkg-config file:
/usr/lib/*/pkgconfig/docker_cpp.pc - CMake config files:
/usr/lib/*/cmake/
debian/copyright
- Apache 2.0 license declarations
- Copyright holders listed
debian/changelog
- Initial 0.1.0-1 release
- Proper format for dpkg
debian/compat
- Debhelper 13 compatibility
# From project root:
debuild -us -uc # Unsigned build
dpkg-buildpackage -us -uc # Alternative methodOutput:
libdocker-cpp0_0.1.0-1_amd64.deb(runtime)libdocker-cpp-dev_0.1.0-1_amd64.deb(development)libdocker-cpp_0.1.0-1_amd64.changes(build info)
sudo dpkg -i libdocker-cpp0_0.1.0-1_amd64.deb
sudo dpkg -i libdocker-cpp-dev_0.1.0-1_amd64.deb- Created:
Formula/docker-cpp.rb- Installs from GitHub release tarball
- Dependencies: boost, curl, spdlog, nlohmann-json
- Release build configuration
- Shared library enabled
- Simple test using pkg-config
- SHA256 placeholder (needs to be calculated for actual releases)
brew install --build-from-source ./Formula/docker-cpp.rb- Created:
docs/PACKAGING.md- Build configuration options
- Step-by-step Debian packaging
- Homebrew publishing process
- Installation verification
- Downstream project usage
- Release process checklist
- Homebrew Core submission guide
- Created:
scripts/bump-version.sh- Automated version updates
- Updates CMakeLists.txt
- Updates include/docker_cpp/version.hh
- Updates debian/changelog
- Usage:
./scripts/bump-version.sh 0.2.0 - Executable: Yes
- Updated:
README.md- Added Installation section
- Package manager instructions (Homebrew, apt-get)
- Source build instructions
- Installation verification commands
File: .github/workflows/build_cmake.yml
Updates:
- Renamed existing Ubuntu job to "Ubuntu Debug" for clarity
- Added
ubuntu-releasejob for Release builds - Added
macos-release-x86_64job for macOS Release builds - Release jobs configure with
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON - Artifact upload configured for Release builds
File: .github/workflows/release.yml
Features:
- Triggered on semantic version tags (v*..)
- Extracts version from git tag
- Builds Release configuration
- Creates source tarball
- Builds .deb packages using debuild
- Creates GitHub Release with automated notes
- Uploads all artifacts (source tarball, .deb files)
- Build log preservation for debugging
- 30-day artifact retention
Automated Release Process:
- On tag push (e.g.,
git tag v0.1.0 && git push origin v0.1.0) - Workflow extracts version:
0.1.0 - Builds Release binary
- Creates source tarball:
docker-cpp-0.1.0.tar.gz - Executes
debuild -us -uc -bto generate:libdocker-cpp0_0.1.0-1_amd64.deb(runtime)libdocker-cpp-dev_0.1.0-1_amd64.deb(dev)
- Creates GitHub Release with pre-filled notes
- Uploads all artifacts to the Release
- Workflow logs available for troubleshooting
Release Notes Template:
- Installation instructions for .deb files
- Homebrew installation note (manual setup required)
- Lists all available artifacts
- Link to PACKAGING.md
File: scripts/validate-packaging.sh
Features:
- 9-phase comprehensive validation (executable)
- Check CMake Infrastructure (version.hh, CMakeLists.txt)
- Build Release Configuration (Ninja, Release mode)
- Test Installation Targets (verify install locations)
- Validate pkg-config (pkg-config discovery)
- Validate CMake Config (find_package() integration)
- Check Debian Packaging (all debian/ files present)
- Validate Homebrew Formula (syntax and audit)
- Check Version Bump Script (executable status)
- Validate Documentation (PACKAGING.md, progress tracking)
- Color-coded output (green/red/yellow)
- Cleanup of temporary directories
- Prints next steps and commands for user
Usage:
./scripts/validate-packaging.shOutput:
- Lists all checks with pass/fail status
- Creates temporary install directory for validation
- Tests pkg-config with custom PKG_CONFIG_PATH
- Tests CMake find_package() with test consumer project
- Provides actionable next steps
Directory: tests/downstream_test/
Contains:
CMakeLists.txt- Example consumer project- Uses
find_package(docker_cpp REQUIRED) - Shows both CMake and pkg-config approaches (commented)
- Links with dependencies (spdlog, nlohmann_json)
- Uses
main.cpp- Complete example application- Demonstrates Docker client initialization
- Shows 3 test cases:
- Ping Docker daemon
- Get Docker version info
- Get Docker system info
- Error handling with try/catch
- Comprehensive logging with spdlog
README.md- Integration documentation- Prerequisites for building
- Two build methods (local and with explicit paths)
- Integration patterns (4 common use cases)
- Error handling guide
- Alternative integration methods
Key Demonstration:
- How consumers would structure their CMakeLists.txt
- Proper error handling for Docker API calls
- Logging setup with spdlog
- Multiple Docker commands usage
Quick Validation:
# Run comprehensive validation
./scripts/validate-packaging.sh
# Manual Release build test
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -G Ninja -S . -B build-rel
cmake --build build-rel
cmake --install build-rel --prefix /tmp/test-install
# Test downstream project
cmake -DCMAKE_PREFIX_PATH=/tmp/test-install/lib/cmake -S tests/downstream_test -B test-build
cmake --build test-build
./test-build/consumer_exampleDebian Package Testing:
# Requires: sudo apt-get install debhelper devscripts fakeroot
debuild -us -uc -b
sudo dpkg -i ../*.debHomebrew Formula Testing:
# Requires: Homebrew installed
brew audit --strict ./Formula/docker-cpp.rb
brew install --build-from-source ./Formula/docker-cpp.rbinclude/docker_cpp/version.hh- Version constantsdocker_cpp.pc.in- pkg-config templatedocker_cppConfig.cmake.in- CMake package configdebian/control- Debian package metadatadebian/rules- Debian build rulesdebian/libdocker-cpp0.install- Runtime package filesdebian/libdocker-cpp-dev.install- Dev package filesdebian/copyright- License informationdebian/changelog- Release historydebian/compat- Debhelper compatibilityFormula/docker-cpp.rb- Homebrew formuladocs/PACKAGING.md- Packaging documentationscripts/bump-version.sh- Version bump utility.github/workflows/release.yml- GitHub Release workflow ✨ NEWscripts/validate-packaging.sh- Validation script ✨ NEWtests/downstream_test/CMakeLists.txt- Consumer example ✨ NEWtests/downstream_test/main.cpp- Consumer main code ✨ NEWtests/downstream_test/README.md- Consumer documentation ✨ NEW
CMakeLists.txt- Added versioning, options, install targets, pkg-config, CMake configsrc/CMakeLists.txt- Added SOVERSION, install() targetREADME.md- Added Installation section with package manager instructions.github/workflows/build_cmake.yml- Added Release build jobs ✨ UPDATED
✅ Phases 1-6 FULLY COMPLETED
The complete packaging infrastructure is now in place:
- Version management with semantic versioning
- CMake integration (find_package, pkg-config)
- Debian/Ubuntu package structure
- Homebrew formula
- GitHub Actions for automated builds and releases
- Comprehensive validation infrastructure
- Downstream consumer examples
-
Local Release Builds:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -G Ninja -S . -B build cmake --build build cmake --install build --prefix /usr -
Automated Validation:
./scripts/validate-packaging.sh
-
Package Building:
debuild -us -uc -b # Creates .deb files -
Downstream Integration:
find_package(docker_cpp REQUIRED) target_link_libraries(myapp PRIVATE docker_cpp::docker_cpp)
-
Automated GitHub Releases:
git tag v0.1.0 git push origin v0.1.0 # Workflow automatically builds, packages, and releases
- Run
./scripts/validate-packaging.shto verify all infrastructure - Test Release build locally with validation script
- Test downstream project build in
tests/downstream_test/ - Build .deb packages (requires:
sudo apt-get install debhelper devscripts fakeroot)
- Calculate SHA256 hash for actual release:
SHA256=$(sha256sum docker-cpp-0.1.0.tar.gz | cut -d' ' -f1) sed -i "s/sha256 .*/sha256 '${SHA256}'/" Formula/docker-cpp.rb
- Tag release:
git tag v0.1.0 && git push origin v0.1.0 - Verify GitHub Actions workflow executes successfully
- Verify artifacts uploaded to GitHub Releases
- Submit Homebrew formula to homebrew-core
- Optional: Set up Launchpad PPA for Ubuntu distribution
- Create release notes with installation instructions
- Update project documentation with installation links
-DCMAKE_BUILD_TYPE=Release # Build type
-DBUILD_SHARED_LIBS=ON # Shared library (ON for packages)
-DBUILD_TESTS=OFF # Disable tests for packages
-DCMAKE_INSTALL_PREFIX=/usr/local # Install path- Current Version: 0.1.0
- SOVERSION: 0
- Package Naming: docker-cpp (Homebrew), libdocker-cpp (Debian)
- Library Name: libdocker_cpp_client
- macOS: 10.15+ (Homebrew)
- Ubuntu: 20.04 LTS, 22.04 LTS, 24.04 LTS (Debian)
- Debian: 11 (Bullseye), 12 (Bookworm)