TGViewer
Learn Python Coding Learn Python Coding @pythonre Β· 40.7K subscribers
Post #9545 1.25K
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:

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
More from @pythonre
  1. Oct 9, 20267 Days Certified AI Agents with Python: Autonomous Apps Build autonomous AI agents with Py…
  2. Oct 7, 2026A distinctive bot for subscribing to courses on the most popular educational platforms acr…
  3. Oct 7, 2026Python Lists: A Quick Reference 🐍 * Definition: Lists are ordered, mutable collections th…
  4. Oct 7, 2026πŸ“± 270 tools for Python developers The repository contains: 🫑 Linters and formatters; πŸ«‘β€¦
  5. Oct 7, 2026Hands On Python Data Science - Data Science Bootcamp Master Python for Data Science with R…
  6. Oct 6, 2026Post #9851
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’