{"id":28187854,"url":"https://github.com/benitomartin/uv-docker-benchmark","last_synced_at":"2026-05-08T10:34:53.011Z","repository":{"id":293425418,"uuid":"950556108","full_name":"benitomartin/uv-docker-benchmark","owner":"benitomartin","description":"Docker Container Optimization Benchmark","archived":false,"fork":false,"pushed_at":"2025-05-15T08:28:17.000Z","size":196,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T07:46:04.130Z","etag":null,"topics":["benchmark","docker","fastapi","python","uv"],"latest_commit_sha":null,"homepage":"https://medium.com/@benitomartin/deep-dive-into-uv-dockerfiles-by-astral-image-size-performance-best-practices-5790974b9579","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benitomartin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-18T10:47:11.000Z","updated_at":"2025-06-13T07:27:50.000Z","dependencies_parsed_at":"2025-05-15T09:34:00.860Z","dependency_job_id":"7898952e-740d-4429-a744-7df854117fa4","html_url":"https://github.com/benitomartin/uv-docker-benchmark","commit_stats":null,"previous_names":["benitomartin/uv-docker-benchmark"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/benitomartin/uv-docker-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benitomartin%2Fuv-docker-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benitomartin%2Fuv-docker-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benitomartin%2Fuv-docker-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benitomartin%2Fuv-docker-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benitomartin","download_url":"https://codeload.github.com/benitomartin/uv-docker-benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benitomartin%2Fuv-docker-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32776898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","docker","fastapi","python","uv"],"created_at":"2025-05-16T08:10:50.812Z","updated_at":"2026-05-08T10:34:52.993Z","avatar_url":"https://github.com/benitomartin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker + uv Benchmark\n\n![Image](https://github.com/user-attachments/assets/e7ef5d59-d122-44c3-97e4-432a770c6ac8)\n\nThis project demonstrates different approaches to building Python applications using `uv` package manager with Docker, featuring three distinct Dockerfile strategies:\n\n- `singlestage.Dockerfile`: Single-stage build that keeps `uv` in the final image\n- `standalone.Dockerfile`: Multi-stage build using system Python, removes `uv` in the final stage\n- `multistage.Dockerfile`: Multi-stage build using uv-managed Python, removes `uv` in the final stage\n\nThe following [blog](https://medium.com/@benitomartin/deep-dive-into-uv-dockerfiles-by-astral-image-size-performance-best-practices-5790974b9579) describes the differences between these strategies.\n\n## Project Structure\n\n```\n.\n├── singlestage.Dockerfile\n├── multistage.Dockerfile\n├── standalone.Dockerfile\n├── src/\n│   └── uv_docker_example/\n│       └── __init__.py\n├── pyproject.toml\n├── uv.lock\n├── .dockerignore\n└── benchmark_docker_images.py\n```\n## Benchmarking\n\nThe project includes a comprehensive benchmarking tool (`benchmark_docker_images.py`) that measures:\n\n- Image sizes\n- Build times \n\nTo run the benchmark:\n\n```bash\nuv venv\nsource .venv/bin/activate\nuv sync\nuv run benchmark_docker_images.py\n```\n\nThe script will:\n1. Build each Dockerfile\n2. Compare results between different strategies\n3. Clean up images after testing\n\n### Sample Benchmark Output\n\nSize (including all dependencies):\n\n- Multi-Stage   → 4'126.72 MB\n- Standalone   → 4'157.44 MB\n- Single-Stage  → 4'188.16 MB\n\nBuild time:\n\n- Multi-Stage   → 2m 9.5s\n- Standalone   → 2m 16.6s\n- Single-Stage  → 3m 0.5s\n\n## Dependencies\n\nMain dependencies:\n- FastAPI\n- scikit-learn\n- MLflow\n- TensorFlow\n- LightGBM\n- NumPy\n- Pandas\n- PyArrow\n- SciPy\n- Pydantic\n\nDevelopment dependencies:\n- Ruff (≥0.6.2)\n- FastAPI CLI (≥0.0.5)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenitomartin%2Fuv-docker-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenitomartin%2Fuv-docker-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenitomartin%2Fuv-docker-benchmark/lists"}