-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Build Setup
The updated Docker build workflow implements semantic versioning, multi-platform builds, and automated releases - matching your stream-harvestarr repository strategy.
- Automatic version bumping based on commit messages
- GitHub releases with changelogs
- Tags:
latest,dev, and semantic versions (e.g.,v1.2.3)
-
linux/amd64(x86_64 - most servers) -
linux/arm64(ARM 64-bit - Apple Silicon, Raspberry Pi 4)
-
main: Builds
latest+ semantic version tags -
development: Builds
devtag - tags: Builds specific version tags
- Build cache management (purges old caches)
- SBOM (Software Bill of Materials) generation
- Provenance attestation for security
- Docker Hub description sync
- GitHub release creation
- Portainer webhook trigger
You need to add these secrets to your GitHub repository:
Value: ryakel
Purpose: Your Docker Hub username
Value: Your Docker Hub access token (NOT password!) Purpose: Authentication to push images
Value: Your Portainer webhook URL Purpose: Trigger auto-deployment after build
- Login to Docker Hub: https://hub.docker.com/
- Go to Account Settings β Security
-
Click "New Access Token"
- Description:
GitHub Actions - flight-budget - Access permissions:
Read, Write, Delete
- Description:
- Copy the token (you'll only see it once!)
- Go to your repository: https://github.com/ryakel/flight-budget
- Click Settings β Secrets and variables β Actions
- Click "New repository secret"
Add these three secrets:
Name: DOCKER_USERNAME
Value: ryakel
Name: DOCKER_TOKEN
Value: [paste your Docker Hub token]
Name: PORTAINER_WEBHOOK_URL
Value: [your Portainer webhook URL - optional]
The workflow automatically bumps versions based on commit message prefixes:
| Commit Message | Version Change | Example |
|---|---|---|
fix: ... or patch: ...
|
Patch (0.0.x) | v1.2.3 β v1.2.4 |
minor: ... |
Minor (0.x.0) | v1.2.3 β v1.3.0 |
major: ... or breaking: ...
|
Major (x.0.0) | v1.2.3 β v2.0.0 |
| Any other message | Patch (0.0.x) | v1.2.3 β v1.2.4 |
# Patch release (v1.2.3 β v1.2.4)
git commit -m "fix: resolve CSV upload bug"
git commit -m "patch: update dependencies"
git commit -m "chore: improve logging"
# Minor release (v1.2.3 β v1.3.0)
git commit -m "minor: add aircraft comparison feature"
git commit -m "feat: implement dark mode"
# Major release (v1.2.3 β v2.0.0)
git commit -m "major: redesign UI with new framework"
git commit -m "breaking: remove legacy API endpoints"1. Code pushed to main
β
2. Determine version bump from commit message
β
3. Create new Git tag (e.g., v1.2.4)
β
4. Build Docker image for multiple platforms
β
5. Push to Docker Hub with TWO tags:
- ryakel/flight-budget:latest
- ryakel/flight-budget:v1.2.4
β
6. Create GitHub Release with changelog
β
7. Update Docker Hub description
β
8. Trigger Portainer webhook (if configured)
β
9. Done! β
1. Code pushed to development
β
2. Build Docker image for multiple platforms
β
3. Push to Docker Hub with tag:
- ryakel/flight-budget:dev
β
4. Done! β
1. Tag pushed (e.g., git tag v1.5.0 && git push --tags)
β
2. Build Docker image for multiple platforms
β
3. Push to Docker Hub with tag:
- ryakel/flight-budget:v1.5.0
β
4. Done! β
After several commits, your Docker Hub will have:
ryakel/flight-budget:latest β Always points to latest main build
ryakel/flight-budget:dev β Latest development build
ryakel/flight-budget:v1.0.0 β Semantic version tags
ryakel/flight-budget:v1.1.0
ryakel/flight-budget:v1.1.1
ryakel/flight-budget:v1.2.0
ryakel/flight-budget:v2.0.0
services:
flight-budget:
# Use latest (auto-updates)
image: ryakel/flight-budget:latest
# OR use specific version (pinned)
image: ryakel/flight-budget:v1.2.4
# OR use dev (testing)
image: ryakel/flight-budget:dev- Go to Stacks β flight-budget
- Edit stack
- Change image tag in
docker-compose.yml - Update the stack
The workflow includes automatic cache purging:
- name: Purge Build Cache
uses: MyAlbum/purge-cache@v2
with:
max-age: 5400 # Keep caches from last 90 minutesBenefits:
- Prevents cache bloat
- Saves GitHub Actions storage
- Keeps builds fast
The workflow builds for multiple architectures:
platforms: linux/arm64,linux/amd64What this means:
- β Works on Intel/AMD servers (amd64)
- β Works on ARM servers (arm64)
- β Works on Raspberry Pi 3/4 (arm64)
- β Works on Apple Silicon servers (arm64)
Build time: ~5-10 minutes (GitHub Actions builds all platforms in parallel)
The workflow generates security metadata:
sbom: true # Software Bill of Materials
provenance: mode=max # Build provenance attestationBenefits:
- Track all dependencies in your image
- Verify image authenticity
- Meet security compliance requirements
- View with
docker buildx imagetools inspect
Every push to main creates a GitHub Release:
Release includes:
- Semantic version tag (e.g., v1.2.4)
- Automated changelog from commits
- Link to Docker Hub image
- Build artifacts
View releases: https://github.com/ryakel/flight-budget/releases
The workflow automatically updates your Docker Hub README:
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v4What syncs:
- Repository description
- Full README content
- Links and documentation
Your Docker Hub page will always match your GitHub README!
Problem: Docker Hub authentication failed Solution:
- Verify
DOCKER_USERNAMEandDOCKER_TOKENsecrets exist - Regenerate Docker Hub token if needed
- Ensure token has
Read, Write, Deletepermissions
Problem: Secret doesn't exist in GitHub Solution: Add the secret following Step 2
Problem: Tag not created on main push Solution:
- Ensure you're pushing to
mainbranch - Check commit message includes version keyword
- Verify
GITHUB_TOKENhas permissions
Problem: Build takes too long and times out Solution:
- This is rare but can happen
- Retry the workflow (often works second time)
- Consider reducing platforms if needed
Problem: Container not redeploying Solution:
- Check
PORTAINER_WEBHOOK_URLis correct - Verify webhook exists in Portainer
- Check Portainer logs for errors
# Create development branch
git checkout -b development
# Make a change
echo "# Test" >> README.md
git add README.md
git commit -m "test: development build"
git push origin development
# Check GitHub Actions
# Should build: ryakel/flight-budget:dev# Switch to main
git checkout main
# Make a change
echo "# New feature" >> README.md
git add README.md
git commit -m "feat: add new feature"
git push origin main
# Check:
# 1. GitHub Actions runs
# 2. Creates tag (e.g., v0.0.1)
# 3. Builds two tags: latest + v0.0.1
# 4. Creates GitHub Release
# 5. Triggers Portainer webhook# Create and push tag
git tag v1.0.0
git push origin v1.0.0
# Check GitHub Actions
# Should build: ryakel/flight-budget:v1.0.0Repository β Actions β Docker Builder
View:
- Build logs
- Platform-specific build times
- Cache usage
- Errors and warnings
https://hub.docker.com/r/ryakel/flight-budget/tags
View:
- All tags
- Image sizes
- Architecture support
- Pull statistics
Repository β Releases
View:
- Version history
- Changelogs
- Download statistics
β Good:
git commit -m "fix: resolve aircraft persistence bug"
git commit -m "minor: add PDF export feature"
git commit -m "major: redesign UI"β Bad:
git commit -m "updates"
git commit -m "WIP"
git commit -m "asdfasdf"- Patch (0.0.x): Bug fixes, minor updates
- Minor (0.x.0): New features, non-breaking changes
- Major (x.0.0): Breaking changes, major rewrites
- main: Production-ready code
- development: Active development, testing
- feature/*: Individual features (merge to development)
| Feature | Old Workflow | New Workflow |
|---|---|---|
| Versioning | SHA-based | Semantic (v1.2.3) |
| Platforms | 2 (amd64, arm64) | 2 (amd64, arm64) |
| Tags | latest only | latest + versions |
| Releases | Manual | Automated |
| Changelog | Manual | Auto-generated |
| Cache | Registry | GitHub Actions |
| SBOM | No | Yes |
| Provenance | No | Yes |
| Hub Description | Manual | Auto-synced |
- Add
DOCKER_USERNAMEsecret - Add
DOCKER_TOKENsecret - Add
PORTAINER_WEBHOOK_URLsecret (optional) - Create
developmentbranch - Test build on development
- Test build on main
- Verify Docker Hub tags
- Check GitHub Release created
- Confirm Portainer webhook works
- Update Portainer to use
:latesttag
β Token-based authentication (instead of password) β Semantic versioning (v1.2.3) β Multi-platform support (3 architectures) β Automated GitHub releases β Build cache management β SBOM & provenance β Docker Hub description sync β Development branch support
- Add 2 required secrets (DOCKER_USERNAME, DOCKER_TOKEN)
- Add 1 optional secret (PORTAINER_WEBHOOK_URL)
-
Push to main with a commit message like:
feat: enable semantic versioning - Watch the magic happen! π
Documentation: This guide
Workflow File: .github/workflows/docker-build.yml
Status: Ready to use after secrets are configured
Next Steps: Add secrets and test!
π View on GitHub | π³ Docker Hub
π Report Issue | π¬ Discussions
License: MIT License | Copyright (c) 2024-2025 FliteAxis
π Getting Started
π¦ Deployment
π§ Development
π Security
- Security Setup Guide
- Security CI/CD Pipeline
- Code Quality & Linting
- SBOM Management
- Vulnerability Scanning
π Dependencies
π³ Docker
π Reference
π Links