-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Docker builds in GitHub Actions are taking 15+ minutes, making deployments very slow.
Evidence
- IBM Code Engine staging deployment stuck on backend image build for 16+ minutes
- Frontend and backend images both building from scratch each time
- No effective layer caching being utilized
Root Causes
- Dockerfile inefficiencies: Not optimized for layer caching
- Large dependency installations: Poetry/npm installs happening in every build
- No multi-stage build optimization: Could separate build and runtime stages better
- Rebuilding instead of reusing: Not leveraging pre-built images from publish workflow
Proposed Solutions
Short-term (Quick Win)
- Modify IBM Code Engine workflow to use pre-built images from GHCR
- Only rebuild when Dockerfile changes
- Use
latest
tag from publish.yml workflow
Medium-term (Dockerfile Optimization)
-
Backend Dockerfile.backend:
- Better layer ordering (dependencies before code)
- Multi-stage builds (builder + runtime)
- Leverage buildkit cache mounts for Poetry
-
Frontend Dockerfile.frontend:
- Better layer ordering (package.json before code)
- Multi-stage builds (build + nginx)
- Leverage buildkit cache mounts for npm
Long-term (Advanced)
- Consider building in IBM Cloud Container Registry (faster network)
- Implement Docker buildx bake for parallel builds
- Use GitHub Actions cache more effectively
Success Criteria
- Deployment time reduced from 15+ minutes to under 5 minutes
- Builds only when code/dependencies change
- Effective layer caching working
Related
- IBM Code Engine deployment workflow: .github/workflows/ibm-code-engine-staging.yml
- Backend Dockerfile: backend/Dockerfile.backend
- Frontend Dockerfile: frontend/Dockerfile.frontend
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request