This Is How You Write an Efficient Python Dockerfile

Published: 14 March 2025
on channel: ArjanCodes
60,824
2.2k

👷 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/efficien....

🎓 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


On this page of the site you can watch the video online This Is How You Write an Efficient Python Dockerfile with a duration of hours minute second in good quality, which was uploaded by the user ArjanCodes 14 March 2025, share the link with friends and acquaintances, this video has already been watched 60,824 times on youtube and it was liked by 2.2 thousand viewers. Enjoy your viewing!