- Notifications
You must be signed in to change notification settings - Fork 249
Open
Description
🐳 Add GitHub Actions for Automated Docker Image Building
Problem Statement
Currently, the project requires manual Docker image building and distribution. Users need to build images locally using docker-compose.
Proposed Solution
Implement a comprehensive GitHub Actions workflow that automatically builds and publishes Docker images to GitHub Container Registry.
Features to Add
🏗️ Production Dockerfiles
-
Dockerfile- Standard CPU-only image with multi-architecture support (AMD64/ARM64) -
Dockerfile.gpu- GPU-enabled image with CUDA 11.8 support (AMD64 only) - Optimized for production with security best practices
⚙️ GitHub Actions Workflow
- Automated building on push to main/develop branches
- Build testing on pull requests (without publishing)
- Multi-architecture builds (AMD64 + ARM64 for CPU images)
- Automatic tagging based on Git events:
latestfor main branchdevelopfor develop branchv1.2.3for version tagspr-123for pull requests
📦 Container Registry Integration
- Publish to GitHub Container Registry (
ghcr.io) - Proper image tagging and versioning
- Layer caching for faster builds
- Security scanning integration
🚀 Production Configurations
-
docker-compose.prod.ymlusing pre-built images -
.env.prod.exampletemplate for production deployments - Health check endpoints for container monitoring
📚 Documentation
- Comprehensive build guide (
DOCKER_BUILD_GUIDE.md) - Usage examples and troubleshooting
- Architecture support matrix
Benefits
- 🚀 Faster Deployment: Users can pull pre-built images instead of building locally
- 🔄 Consistent Builds: All images built in standardized GitHub environment
- 🛡️ Security: Production hardened images with non-root users
- 📈 Scalability: Multi-architecture support for different deployment targets
- 🔧 Developer Experience: Simplified setup for contributors and users
- 🎯 CI/CD Ready: Foundation for automated testing and deployment
Technical Details
Image Variants
-
Standard Image:
ghcr.io/catchthetornado/text-extract-api:latest- Python 3.10 slim base
- CPU-only processing
- Multi-architecture (AMD64/ARM64)
-
GPU Image:
ghcr.io/catchthetornado/text-extract-api-gpu:latest- NVIDIA CUDA 11.8 base
- GPU-accelerated processing
- AMD64 architecture only
Workflow Triggers
- Push to
main→ Build and publishlatestimages - Push to
develop→ Build and publishdevelopimages - Git tags (
v*) → Build and publish versioned images - Pull requests → Build and test (no publish)
Security Features
- Non-root user execution (
appuser) - Minimal attack surface with slim base images
- Health check endpoints for monitoring
- Secure layer caching and optimization
Implementation Checklist
- Create production
Dockerfile - Create GPU-enabled
Dockerfile.gpu - Implement GitHub Actions workflow (
.github/workflows/docker-build.yml) - Add health check endpoint to FastAPI application
- Create production Docker Compose configuration
- Add comprehensive documentation
- Update
.dockerignorefor optimized builds - Create environment template for production
- Test workflow with sample builds
Success Criteria
✅ Automated Builds: Images build automatically on code changes
✅ Multi-Platform: CPU images work on both Intel/AMD and Apple Silicon
✅ GPU Support: GPU images work with NVIDIA Docker runtime
✅ Documentation: Clear setup and usage instructions
✅ Testing: PR builds validate Docker configurations
✅ Production Ready: Images suitable for production deployment
Metadata
Metadata
Assignees
Labels
No labels