Skip to content

Optimize Docker images for size and 4G deploy bandwidth#338

Open
MateoLostanlen wants to merge 5 commits intodevelopfrom
optimize_docker_size
Open

Optimize Docker images for size and 4G deploy bandwidth#338
MateoLostanlen wants to merge 5 commits intodevelopfrom
optimize_docker_size

Conversation

@MateoLostanlen
Copy link
Copy Markdown
Member


Restructure both Dockerfiles with layered caching so that code-only deploys pull ~2.5 MB over 4G instead of 400 MB+. Split requirements.txt into stable pip deps and git-based deps (requirements-git.txt), each in its own Docker layer. Switch to opencv-python-headless, remove duplicate opencv in camera API, and drop build-essential and git from the camera API runtime image. Add .dockerignore files and multi-platform CI (linux/amd64 + linux/arm64) building and pushing both images to Docker Hub. make lock now auto-splits requirements.

Image sizes

Image Before After
pyro-engine 1.30 GB 1.22 GB
pyro-camera-api 1.50 GB 1.11 GB
Image Pull size
pyro-engine ~2.5 MB
pyro-camera-api ~385 KB

Test plan: both images build, engine import check passes (from pyroengine import SystemController), make run starts the stack, CI triggers on push to develop for both platforms.

- Split requirements into stable (pip) and git-based for layered caching
- Multi-stage build for engine to isolate git dependency
- Remove duplicate opencv-python, use headless variant
- Remove build-essential and git from camera API runtime
- Add .dockerignore files
- Update Makefile lock target to auto-split requirements
- Build and push both images for linux/amd64 and linux/arm64
- Trigger on develop, main, and version tags
- GHA layer cache for faster rebuilds
- Test both images in docker.yml CI
- Remove redundant dockerhub-publish from release.yml
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.59%. Comparing base (07b64c5) to head (07006ab).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #338   +/-   ##
========================================
  Coverage    72.59%   72.59%           
========================================
  Files            7        7           
  Lines          602      602           
========================================
  Hits           437      437           
  Misses         165      165           
Flag Coverage Δ
unittests 72.59% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant