𝘼 𝟐𝙂𝘽 𝘿𝙤𝙘𝙠𝙚𝙧 𝙞𝙢𝙖𝙜𝙚 𝙞𝙨 𝙖 𝙙𝙚𝙥𝙡𝙤𝙮𝙢𝙚𝙣𝙩 𝙗𝙤𝙩𝙩𝙡𝙚𝙣𝙚𝙘𝙠. I was building a GenAI API and the image size was massive. Every deploy took forever. Then I switched to multi-stage builds. Here is the exact snippet that cut the size by 70%: # 𝘚𝘵𝘢𝘨𝘦 1: 𝘉𝘶𝘪𝘭𝘥 𝘍𝘙𝘖𝘔 𝘱𝘺𝘵𝘩𝘰𝘯:3.10-𝘴𝘭𝘪𝘮 𝘈𝘚 𝘣𝘶𝘪𝘭𝘥𝘦𝘳 𝘞𝘖𝘙𝘒𝘋𝘐𝘙 /𝘢𝘱𝘱 𝘊𝘖𝘗𝘠 𝘳𝘦𝘲𝘶𝘪𝘳𝘦𝘮𝘦𝘯𝘵𝘴.𝘵𝘹𝘵 . 𝘙𝘜𝘕 𝘱𝘪𝘱 𝘪𝘯𝘴𝘵𝘢𝘭𝘭 --𝘵𝘢𝘳𝘨𝘦𝘵=/𝘢𝘱𝘱/𝘥𝘦𝘱𝘴 -𝘳 𝘳𝘦𝘲𝘶𝘪𝘳𝘦𝘮𝘦𝘯𝘵𝘴.𝘵𝘹𝘵 # 𝘚𝘵𝘢𝘨𝘦 2: 𝘙𝘶𝘯 𝘍𝘙𝘖𝘔 𝘱𝘺𝘵𝘩𝘰𝘯:3.10-𝘢𝘭𝘱𝘪𝘯𝘦 𝘞𝘖𝘙𝘒𝘋𝘐𝘙 /𝘢𝘱𝘱 𝘊𝘖𝘗𝘠 --𝘧𝘳𝘰𝘮=𝘣𝘶𝘪𝘭𝘥𝘦𝘳 /𝘢𝘱𝘱/𝘥𝘦𝘱𝘴 /𝘢𝘱𝘱/𝘥𝘦𝘱𝘴 𝘊𝘖𝘗𝘠 . . 𝘌𝘕𝘝 𝘗𝘠𝘛𝘏𝘖𝘕𝘗𝘈𝘛𝘏=/𝘢𝘱𝘱/𝘥𝘦𝘱𝘴 𝘊𝘔𝘋 ["𝘱𝘺𝘵𝘩𝘰𝘯", "𝘢𝘱𝘱.𝘱𝘺"] The logic is simple: • 𝙎𝙩𝙖𝙜𝙚 𝟏 installs dependencies in a full environment. • 𝙎𝙩𝙖𝙜𝙚 𝟐 copies only the artifacts needed to run. No build tools. No cache. Just the app. Smaller images mean faster scaling and cheaper storage. 𝘼𝙧𝙚 𝙮𝙤𝙪 𝙨𝙩𝙞𝙡𝙡 𝙪𝙨𝙞𝙣𝙜 𝙨𝙞𝙣𝙜𝙡𝙚-𝙨𝙩𝙖𝙜𝙚 𝙗𝙪𝙞𝙡𝙙𝙨 𝙛𝙤𝙧 𝙝𝙚𝙖𝙫𝙮 𝙖𝙥𝙥𝙨? #Docker #DevOps #Python #PlatformEngineering #ShreyasTech
Cut Docker Image Size by 70% with Multi-Stage Builds
More Relevant Posts
-
📢 532 downloads in 3 days. No marketing. Open Source. No VC money.🚀 Just a Python framework that gets out of your way. We built SynapseKit because debugging LLM apps was taking longer than building them. Too many layers. Too much magic. Too little control over what was actually happening. So we started over. From scratch. ⚡ Async-native. Streaming-first. 2 dependencies. Code you can read on a Monday morning without coffee. What's inside: 🔌 13 LLM providers behind one interface :swap models in one line 🔍 10 retrieval strategies: RAG Fusion, CRAG, Ensemble, Self-Query 🔀 Graph workflows with human-in-the-loop and SSE streaming 🛠️ 16 tools, 12 loaders, 4 memory backends ✅ 540 tests passing No hidden chains. No magic. Just code that does what you think it does. If you're building LLM apps in Python and want something you can actually debug: 📦 pip install synapsekit[openai] 🔗 https://lnkd.in/d2fGSPkX #Python #LLM #RAG #OpenSource #AI #MLEngineering #MachineLearning #Developers #SoftwareEngineering #AgenticAI
To view or add a comment, sign in
-
From UI → working product 👇 Here’s a quick demo of the expense tracker I built using Python 💰 In this version (v1), you can: • Add income & expenses • Track balance instantly • View transaction history • View analytics & insights Built this to better understand my own spending habits — and it turned into a full working app. Currently improving it and planning to deploy it soon 🚀 Watch till the end to see insights 👀 Would love your feedback 🙌 #Python #Streamlit #WebDevelopment #BuildInPublic #SoftwareDevelopment #StudentDeveloper #Projects #LearningInPublic
To view or add a comment, sign in
-
Actionpackd Knowledge bites - Day 46 What is flask in python ? Flask is a lightweight Python web framework used to build web applications and APIs quickly. It follows a minimalistic approach, giving developers full control instead of enforcing strict project structures. Key features : 1. Lightweight and flexible (micro-framework) 2. Built-in development server and debugger 3. Uses Jinja2 templating engine 4. REST API friendly 5. Easy integration with databases and extensions How it works ? 1. Define routes (URLs) using decorators 2. Each route maps to a Python function 3. Function processes request and returns response 4. Server renders output (HTML/JSON) Example use case • Backend for AI apps (e.g., serving a model via API) • Lightweight dashboards • MVPs and quick prototypes Why it’s popular ? • Simple to learn and start • Highly customizable • Large ecosystem of extensions , like Flask SQLAlchemy , Flask Login and more . #Actionpackd #KnowledgeBites #Flask #Python #AI
To view or add a comment, sign in
-
-
I’ve been working on refactoring a legacy Django project to a more modern Flask project, and I will tell you this… it really shows how much complexity can build up in a system over time. The original app worked, but it had grown pretty heavy and difficult to maintain. Moving it to Flask has been a good opportunity to simplify the architecture, separate business logic from routes, and make the code easier to understand and extend. It is a good reminder that sometimes improving a system is not about adding features, but about making the foundation cleaner for the developers who come next. #SoftwareEngineering #Python #Flask #Django #Refactoring #Backenddevelopment #Cleanarchitecture
To view or add a comment, sign in
-
Two years into building backend systems with Python and FastAPI, one lesson keeps proving itself: Async isn't just a performance trick — it's a mindset shift. When I first started writing async endpoints, I treated it like a checkbox. "Use await, get speed." But the real value clicked when I saw how thoughtfully designed async flows could handle surges in traffic without the backend becoming the bottleneck. The difference between a system that holds up under pressure and one that doesn't often isn't the framework — it's whether the engineer truly understood why they made each architectural decision. That realization changed how I approach every API I build now. I ask: "What happens when 10x the requests hit this endpoint?" before I write a single line. It's made me a more intentional engineer, not just a faster one. For those building with FastAPI or any async framework — what's a lesson that changed how you think about backend design? Would love to hear what shifted your perspective. 👇 #BackendDevelopment #Python #FastAPI #SoftwareEngineering #APIDevelopment #LessonsLearned #TechCommunity
To view or add a comment, sign in
-
agentpad is live. A multi-language runtime for AI agents that actually runs your code — bash, Python, JavaScript, SQL - against a real project directory. Not a sandbox pretending to be one. Most agent runtimes fake the environment. agentpad doesn't. You get full control over what the agent can touch, what it can write, and exactly what happened when it's done. > Overlay mode to stage changes before they stick. > Read-only mode when writes aren't allowed. > Glob allowlists and timeouts so nothing runs wild. > Structured output every time - stdout, stderr, exitCode, files written. > A full session run log so nothing is a black box. > OpenAI tool helpers so you're not rewriting the function-calling loop from scratch. Just run npm install agentpad Or pip install agentpad Website/Docs: https://slaps.dev/agentpad #openSource #aiAgents #developerTools #typescript #python
To view or add a comment, sign in
-
When I was building agents-js and Slapify, the browser side was only half the story. The other half was always: run this in the repo - a script, a test, a SQL check, a one-off patch - and get back something structured I could log, replay, or hand to the next step. I didn't want another bespoke subprocess wrapper per project. agentpad is that layer. Bash, Python, Node, SQL against a real working tree, with timeouts, glob allowlists, and a clear result object every time. Same idea in TypeScript and Python, because agents don't care which language your stack speaks. The piece I reach for most is overlay mode - full temp copy of the directory, agent edits there, then apply or discard. It made "let the model touch files" feel survivable in production, not reckless. If you're wiring agents, CI, or internal copilots on top of real codebases - try it and tell me what breaks. Github: https://lnkd.in/gi4Ccqb2 Website: https://lnkd.in/grJXTicc #openSource #aiAgents #developerTools #typescript #python
agentpad is live. A multi-language runtime for AI agents that actually runs your code — bash, Python, JavaScript, SQL - against a real project directory. Not a sandbox pretending to be one. Most agent runtimes fake the environment. agentpad doesn't. You get full control over what the agent can touch, what it can write, and exactly what happened when it's done. > Overlay mode to stage changes before they stick. > Read-only mode when writes aren't allowed. > Glob allowlists and timeouts so nothing runs wild. > Structured output every time - stdout, stderr, exitCode, files written. > A full session run log so nothing is a black box. > OpenAI tool helpers so you're not rewriting the function-calling loop from scratch. Just run npm install agentpad Or pip install agentpad Website/Docs: https://slaps.dev/agentpad #openSource #aiAgents #developerTools #typescript #python
To view or add a comment, sign in
-
Write code that doesn't break in production...! When building end-to-end pipelines, reading data from GitHub or external URLs is common. But relying on a "happy path" is a mistake. For robust development, always implement: Logging: To track the flow and capture specific error details. Exception Handling: To prevent the entire app from crashing and get clear "Unable to load" alerts. It’s a simple habit, but it’s what separates a beginner from a Pro Developer. #Python #MLOps #CleanCode #SoftwareEngineering #DataScience #CodingTips
To view or add a comment, sign in
-
-
FastAPI has become the standard for building high-performance Python backends. It successfully combines the developer experience of a lightweight framework with the speed required for modern, asynchronous applications. Here is why it is a go-to for production-ready systems: • Performance: Built on Starlette and Pydantic, it is one of the fastest Python frameworks available. • Efficiency: Features like automatic OpenAPI (Swagger) docs and built-in data validation reduce boilerplate significantly. • Async Support: Native support for asynchronous programming makes it ideal for real-time apps and ML model deployment. • Reliability: Leveraging Python type hints ensures fewer bugs and better editor support during development. Whether you are architecting microservices or a simple REST API, FastAPI provides the scalability and speed that modern software demands. Are you still using Flask for your initial prototypes, or have you made the full switch to FastAPI? . . . #Python #FastAPI #Backend #WebDev #Microservices #Coding
To view or add a comment, sign in
-
-
From UI to Logic: Expanding from Frontend to Python Backend 🐍 I’ve spent a lot of time perfecting the outer shell of applications — building responsive, clean interfaces with Tailwind and shadcn. But great UI is only half the story. Recently, I started diving deeper into Python to understand the logic that powers those interfaces. That means moving beyond styling components and learning concepts like: • Closures & Lambdas — writing flexible and reusable logic • Functional Sorting — understanding how data is processed before reaching the UI • Object-Oriented Programming (OOP) — the foundation of frameworks like Django The goal is simple: Build full-stack applications where the backend is just as powerful as the frontend is beautiful. Next stop: Django models and database architecture. 🚀 #Python #WebDevelopment #Django #Frontend #FullStack #CodingJourney
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Warning if you use Alpine: You might need to install gcc and musl-dev if your Python packages (like numpy/pandas) need to compile C extensions. It's a trade-off between size and build complexity.