This project now includes automated CI/CD pipelines that build Docker images and publish them to GitHub Container Registry (GHCR).
- Copy source code to target host
- Build Docker images on target host
- Slow deployments, potential build failures
- Inconsistent environments
- Pre-built, tested images
- Fast
docker pulldeployments - Consistent environments everywhere
- Version control and rollbacks
- Professional CI/CD pipeline
- Public repository (recommended for free GHCR)
- GitHub Actions enabled
- Packages permissions for Actions
If using private images, add these secrets:
# In GitHub repository settings > Secrets and variables > Actions
GHCR_TOKEN=your_github_personal_access_token- Push to main/develop โ Build and publish images
- Pull requests โ Build images for testing
- Releases โ Build and tag release images
ghcr.io/your-username/sleeper-bot-mcp-server:latest
ghcr.io/your-username/sleeper-bot-llm-agent:latest
ghcr.io/your-username/sleeper-bot-discord-bot:latest
latest- Latest main branchdevelop- Latest develop branchmain-abc123- Specific commit on maindevelop-def456- Specific commit on develop
# Deploy using pre-built images
ansible-playbook -i ansible/inventory.yml ansible/deploy-registry.yml \
-e "github_repository=your-username/sleeper-bot" \
-e "image_tag=latest"# Deploy by building locally (original method)
ansible-playbook -i ansible/inventory.yml ansible/deploy.yml.github/workflows/build-mcp-server.yml.github/workflows/build-llm-agent.yml.github/workflows/build-discord-bot.yml
docker-compose.registry.yml- Pulls from GHCR
ansible/deploy-registry.yml- Deploys from registry
# Required for registry deployment
GITHUB_REPOSITORY=your-username/sleeper-bot
IMAGE_TAG=latest
# Your existing variables
API_KEY=your-secure-api-key
DISCORD_TOKEN=your-discord-token
DEFAULT_LEAGUE_ID=your-league-id
LLM_PROVIDER=ollama
LLM_URL=http://host.docker.internal:11434/api/generate
LLM_MODEL=llama3.2:latest# In ansible/group_vars/sleeper_bot_hosts.yml
github_repository: "your-username/sleeper-bot"
image_tag: "latest"# Push your code to trigger first build
git add .
git commit -m "Add CI/CD pipeline"
git push origin main
# Wait for GitHub Actions to complete
# Check Actions tab in your repository# Deploy using registry images
ansible-playbook -i ansible/inventory.yml ansible/deploy-registry.yml# Make code changes
git add .
git commit -m "Fix bot response handling"
git push origin main
# Wait for new images to build
# Deploy with new images
ansible-playbook -i ansible/inventory.yml ansible/deploy-registry.yml- GitHub repository โ Actions tab
- Monitor build progress and logs
- GitHub repository โ Packages tab
- See all published container images
# On target host
cd /opt/sleeper-bot
# Check status
docker compose ps
# View logs
docker compose logs -f
# Restart services
docker compose restart
# Update to latest images
docker compose pull
docker compose up -d# Deploy specific tag
ansible-playbook -i ansible/inventory.yml ansible/deploy-registry.yml \
-e "image_tag=main-abc123"
# Or rollback on host
cd /opt/sleeper-bot
docker compose pull ghcr.io/your-username/sleeper-bot-mcp-server:main-abc123
docker compose up -d- Public repos: 100% FREE
- Private repos: 500MB free, then $0.50/GB
- Public repos: 2,000 minutes/month FREE
- Private repos: 2,000 minutes/month FREE
- Additional: $0.008/minute
- Small project: $0-5/month
- Medium project: $5-20/month
- Large project: $20+/month
# Check GitHub Actions logs
# Verify Dockerfile syntax
# Check for dependency issues# Verify image names in registry
# Check network connectivity
# Validate environment variables- Permission denied: Check repository permissions
- Image not found: Verify image names and tags
- Build timeout: Check Dockerfile optimization
- Registry auth: Verify GHCR access
โ
Faster deployments - No more building on target hosts
โ
Consistent environments - Same images everywhere
โ
Version control - Tagged releases and rollbacks
โ
Professional CI/CD - Automated testing and building
โ
Cost effective - Free for public repos
โ
Scalable - Easy to deploy to multiple hosts
โ
Reliable - Pre-tested, pre-built images
- Push code to trigger first builds
- Test deployment with registry images
- Set up monitoring for build status
- Configure alerts for build failures
- Add testing to CI/CD pipeline
- Implement staging environment
This CI/CD setup transforms your deployment from a manual, error-prone process to a professional, automated pipeline that's fast, reliable, and scalable!