Full-Stack & APIs7 min readAugust 14, 2026

Production Docker for Node.js & Remix: Multi-Stage Builds & Minimal Alpine Images

Cut container image sizes from 1.2GB down to 90MB. Build secure, non-root Docker images optimized for blazing fast CI/CD deployments.

Nazmul Hawlader
Nazmul Hawlader
Senior Shopify & Full-Stack Engineer
Note: Key takeaways in this guide: • Write multi-stage Dockerfiles that separate build tooling from final runtime artifacts. • Run Node processes under an unprivileged non-root user to mitigate container breakout attacks. • Leverage Docker layer caching for sub-30-second image build times in CI pipelines.

Shipping massive Docker images filled with build compilers, development packages, and git histories wastes container registry storage and slows down autoscaling rollout times. Multi-stage builds solve this cleanly.

1. Multi-Stage Build Architecture

Use an initial stage with full build dependencies (Python, gcc, devDependencies) to compile TypeScript and assets, then copy only the production bundle and runtime node_modules into a minimal Alpine base image.

Summary & Key Conclusion

Slim, hardened Docker containers ensure fast rollouts, lower cloud hosting expenses, and robust security.

Nazmul Hawlader

Written by Nazmul Hawlader

Top Rated

Senior Full-Stack Engineer & Official Shopify App Store developer. Founder of Stockly and Kilo (kilo.nazmulcodes.org), specializing in high-performance Shopify apps, client-side media compression, and sub-second web performance.

Recommended Related Articles