SShortSingh.
Back to feed

Multi-stage Docker builds cut Node image size from 1 GB to a fraction

0
·1 views

Most inherited Node.js Docker images exceed one gigabyte, even though the actual application may occupy only around 40 MB, with the remainder comprising compilers, dev dependencies, npm cache, and source files. This bloat slows deployments, increases security scan times, and widens the attack surface for vulnerabilities. Multi-stage Docker builds address this by using multiple FROM instructions, allowing developers to compile the app in an early stage and copy only the necessary production artifacts into a leaner final image. The final image can be based on a minimal variant like node:20-slim or a distroless image, and should install only production dependencies via npm ci --omit=dev rather than copying node_modules from the build stage. Proper layer ordering — copying lockfiles before source code — also preserves Docker's build cache, keeping repeated builds fast.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Anthropic Publishes August 2026 Risk Report on Claude Misuse and Safeguards

Anthropic has released a redacted August 2026 Risk Report detailing attempted misuse of its Claude AI models through mid-July 2026. The report covers threat categories including cyberattacks, influence operations, surveillance, biological risks, and weapons-related activity. According to Anthropic, every misuse operation discussed in the report was successfully disrupted. The publication builds on the company's August 2025 Threat Intelligence Report and is part of a broader ongoing safety and evaluation effort, which also includes an independent review process involving METR. The report serves as a reminder for businesses deploying AI that models integrated into live workflows and connected data systems require security controls proportional to the risks of misuse.

0
ProgrammingDEV Community ·

Developer Compares Claude, Gemini, and Copilot After Real-World Onboarding Project

A developer recently completed an onboarding audit project using three AI tools — Claude, Gemini, and Microsoft Copilot — relying primarily on their chat interfaces without advanced integrations. Claude emerged as the preferred option, praised for clear pair-programming guidance and its ability to regenerate updated project files on request. The author noted that Claude occasionally needed to be challenged on its responses, such as when it walked back an uncited security recommendation after being pushed for sources. Hallucinations were present but manageable, with Claude openly acknowledging when it had fabricated information. The developer completed the work on Claude's free tier using Sonnet, hitting message limits only twice over two weeks.

0
ProgrammingDEV Community ·

AI Agent Implementation Costs in 2026: From €1,500 to Hundreds of Thousands

The cost of deploying an AI agent in 2026 varies widely, ranging from around €1,500 for a single narrow process to hundreds of thousands of dollars annually for a dedicated in-house team. Key pricing factors include the number of system integrations, data quality, guardrails and evaluation frameworks, and ongoing hosting and model API expenses. According to Upwork data from May 2026, AI engineers charge between $35 and $200 per hour depending on specialisation, while a mid-level agentic engineer in the US commands a base salary of $155,000–$210,000 annually. The KORE1 2026 survey identified building evaluation frameworks as the top skill for agentic engineers, reflecting its significant share of project budgets. Maintenance is a commonly overlooked cost, as agents can degrade within months when models update or business requirements change without ongoing upkeep.

0
ProgrammingDEV Community ·

MockarIo Lets Developers Test Apps via Custom Subdomain Without a Live Backend

MockarIo is a new SaaS platform built to help frontend and mobile developers work independently of backend teams by serving HTTP mock responses from a dedicated subdomain. Developers can register API endpoints, define multiple response variants such as success, validation errors, or timeouts, and switch between them instantly without requiring a backend deployment. Each team or organization gets its own subdomain on mockar.io, reducing conflicts that arise when multiple developers share a single mock environment. The platform was created by an Android developer who faced recurring API bottlenecks while working across large, multi-team projects. MockarIo is available now with a free tier, and the developer is actively seeking feedback on features like OpenAPI import and authentication support.

Multi-stage Docker builds cut Node image size from 1 GB to a fraction · ShortSingh