How to Build and Run Node Apps with Docker and Compose
summary
Shows how to build a small Node image using an Alpine Node base (notes on musl vs glibc), chain RUN instructions to minimize layers, and copy package.json first to avoid rebuilding node_modules. Uses Docker build/run and Docker Compose with a named volume for node_modules and MongoDB service, adds nodemon for live reloads and a wait-for wrapper (netcat) to delay DB connections. Demo builds, creates sharks in the app, and after compose down/up the Mongo volume persists the data.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:59Containers for Node apps
- 4:14Containers versus virtual machines
- 6:03Building Node image
- 12:11Demo: Node app run
- 14:32Add database with Compose
- 18:21Compose for development
- 23:28Managing containers
- 24:12Demo: MongoDB persistence
- 26:30Production deployment prep
related talks
21mScaling Node.js applications with Kubernetes and Docker
22mRapidly Developing Microservices with Node js and Docker
28mScaling Node.js Applications with Kubernetes and Docker
25mNode.js Meets Docker
30mNode.js in a Kubernetes World
44mSpeeding Up Deployment of JavaScript and Node.js Applications
20mCreating Production Ready Containers: What Devs Need to Know to Secure Their Containers
43mMaster production: best practices to build Node.js Docker images
