Back to Browse

This Is How You Write an Efficient Python Dockerfile

60.9K views
Mar 14, 2025
18:46

👷 Review code better and faster with my 3-Factor Framework: https://arjan.codes/diagnosis. In this video, I’ll take you step-by-step through creating an optimized and efficient Docker image. I’ll cover picking the right base image, removing clutter from your Dockerfile, making it more secure, and a few things that you probably didn’t know where possible. 🔥 GitHub Repository: https://git.arjan.codes/2025/efficient-python-dockerfile. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:23 1. Starting Point 3:04 2. Choose The Right Base Image 5:18 3. Do Not Use the Latest Tag 6:21 4. Remove Unnecessary Dependencies 7:25 5. Clean Up Dependencies 8:06 6. Use UV 9:10 7. Use a Multi Stage Build 11:42 8. COPY Only The Things You Need 13:26 9. Load Secrets Using The Secret Mount Type 15:11 10. Run as a local user 16:34 Frustrations 18:15 Final Thoughts #arjancodes #softwaredesign #python

Download

1 formats

Video Formats

360pmp440.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

This Is How You Write an Efficient Python Dockerfile | NatokHD