MiniGit SDK via Docker Distribution
The MiniGit SDK is distributed exclusively through the official Docker Container Images. This guarantees a reproducible environment with all compiled native static libraries (libminigit_sdk.a), C/C++ headers (minigit_sdk.h), and multi-language runtime bindings without needing to install external system compilers, OpenSSL, or Git dependencies on the host.
1. Official Container Images
| Image | Contents | Recommended Use |
|---|---|---|
minigit:latest | Pre-installed CLI binary, C/C++ SDK headers & static library | CLI executions & C++ containerized builds |
minigit-sdk-demo:latest | Compiled SDK multi-language demonstration runner | Testing & reference implementations |
2. Consuming the SDK in Your Dockerfile (Multi-Stage Builds)
The cleanest and most reliable way to consume the MiniGit SDK is by copying the compiled artifacts or modules directly inside your application's Dockerfile. Select your target language below:
# Multi-stage Docker build for C++20 / C consuming MiniGit SDK
FROM ubuntu:24.04 AS build
# Install compiler and build dependencies
RUN apt-get update && apt-get install -y \
build-essential libssl-dev zlib1g-dev libcurl4-openssl-dev
# Copy MiniGit SDK headers and compiled archive directly from official image
COPY /usr/local/include/minigit /usr/local/include/minigit
COPY /usr/local/lib/libminigit_sdk.a /usr/local/lib/libminigit_sdk.a
WORKDIR /app
COPY . .
RUN g++ -std=c++20 main.cpp -lminigit_sdk -lssl -lcrypto -lz -lcurl -o my_service
# Minimal runtime container
FROM ubuntu:24.04 AS runtime
RUN apt-get update && apt-get install -y libssl3 zlib1g libcurl4 && rm -rf /var/lib/apt/lists/*
COPY /app/my_service /usr/local/bin/my_service
WORKDIR /data
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/my_service"]3. Interactive Multi-Language Code Examples
Explore how each language interacts with the SDK once mounted inside the container environment:
#include <minigit/minigit_sdk.h>
#include <iostream>
int main() {
// 1. Initialize or open repository
auto client = minigit::sdk::MiniGitClient::init("./my_repo");
// 2. Stage files
client.add({"file.txt"});
// 3. Create commit
std::string commit_id = client.commit("Initial commit via SDK", "Dev <dev@example.com>");
std::cout << "Created commit: " << commit_id << "\n";
// 4. Branching
client.create_branch("feature");
client.switch_branch("feature");
// 5. Query status and history
auto status = client.status();
std::cout << "Branch: " << status.current_branch << "\n";
auto logs = client.log(10);
for (const auto& c : logs) {
std::cout << c.commit_id << " - " << c.message << "\n";
}
// 6. Cloud sync / backup
client.sync_to_cloud("/data/backup_store", "my_repo");
return 0;
}4. Running the Demonstration Container
MiniGit includes a ready-to-run demonstration container showcasing the SDK in action:
# Build the SDK demo container
docker build -f Dockerfile.sdk-demo -t minigit-sdk-demo .
# Run the containerized SDK demo mounted to your current workspace
docker run --rm -v $(pwd):/data minigit-sdk-demo
Docker Compose
Alternatively, launch both the MiniGit CLI and the SDK demo with Docker Compose:
docker compose up --build