Advice for Python, UV, and Docker 🐍🐳
Sometimes dependencies are better installed separately from the code — this noticeably speeds up the compilation of Docker images 🚀
The idea is simple: first, we install dependencies, then we add the project 🛠
Why is this necessary:
• Docker caches layers and does not rebuild them unnecessarily ⚡️
• if only the code changes — the dependencies are taken from the cache 💾
• if the dependencies change — only the corresponding layer is rebuilt 🔁
• without this, any minor change triggers a full reinstallation 🔄
Example:
#Python #Docker #DevOps #UV #SoftwareEngineering #TechTips
✨ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
🚀 Level up your AI & Data Science skills with HelloEncyclo — a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
✅ 13 courses live + 40+ coming soon
🎯 One access, lifetime updates
🔑 Use code: PRESALE-BOOK-WAVE-2GFG
👉 https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Sometimes dependencies are better installed separately from the code — this noticeably speeds up the compilation of Docker images 🚀
The idea is simple: first, we install dependencies, then we add the project 🛠
Why is this necessary:
• Docker caches layers and does not rebuild them unnecessarily ⚡️
• if only the code changes — the dependencies are taken from the cache 💾
• if the dependencies change — only the corresponding layer is rebuilt 🔁
• without this, any minor change triggers a full reinstallation 🔄
Example:
RUN --mount=type=cache,target=/root/.cache/uv --mount=type=bind,source=uv.lock,target=uv.lock --mount=type=bind,source=pyproject.toml,target=pyproject.toml uv sync --locked --no-install-project
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked
#Python #Docker #DevOps #UV #SoftwareEngineering #TechTips
✨ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
🚀 Level up your AI & Data Science skills with HelloEncyclo — a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
✅ 13 courses live + 40+ coming soon
🎯 One access, lifetime updates
🔑 Use code: PRESALE-BOOK-WAVE-2GFG
👉 https://helloencyclo.com/?ref=HUSSEINSHEIKHO
❤4