Run git-cliff in Docker containers for consistent and isolated changelog generation
git-cliff provides official Docker images that allow you to run the tool in any containerized environment without installing it directly on your system.
# Linux/macOSdocker run --rm -v "$PWD:/app" orhunp/git-cliff:latest# Windows (PowerShell)docker run --rm -v "${PWD}:/app" orhunp/git-cliff:latest# Windows (Command Prompt)docker run --rm -v "%cd%:/app" orhunp/git-cliff:latest
# Use a specific versiondocker run --rm -v "$PWD:/app" orhunp/git-cliff:2.0.0# Use the latest development versiondocker run --rm -v "$PWD:/app" orhunp/git-cliff:main
# Generate changelogdocker compose run --rm git-cliff# Run specific servicedocker compose run --rm changelog# Override commanddocker compose run --rm git-cliff --latest
If you need to customize the Docker image, you can build your own based on the official Dockerfile:
Custom Dockerfile
FROM orhunp/git-cliff:latest# Add your customizationsCOPY custom-cliff.toml /app/cliff.toml# Set default argumentsENTRYPOINT ["git-cliff"]CMD ["--config", "/app/cliff.toml", "--output", "CHANGELOG.md"]
# Build custom imagedocker build -t my-git-cliff .# Run custom imagedocker run --rm -v "$PWD:/app" my-git-cliff
Ensure you’re mounting the repository root, not a subdirectory:
# Correct - mount from repository rootcd /path/to/repodocker run --rm -v "$PWD:/app" orhunp/git-cliff:latest# Incorrect - don't mount subdirectoriesdocker run --rm -v "$PWD/src:/app" orhunp/git-cliff:latest
Make sure the config file is in the mounted directory:
# List files to verifydocker run --rm -v "$PWD:/app" --entrypoint ls orhunp/git-cliff:latest -la# Or specify full pathdocker run --rm -v "$PWD:/app" orhunp/git-cliff:latest --config /app/config/cliff.toml