Sep 22, 2024
First Stage: Build
node:alpine
.usr/src/app
.package.json
and run npm install
.Second Stage: Production
npm install
with production flag to exclude dev-dependencies.package.json
after installation to optimize image.NODE_ENV
to production for optimized performance.Setup Version & Services
Database Configuration
mongo
.nestjs_network
with bridge driver..env
from version control.Create and Setup EC2
Connect and Install Docker
Set Up Application on EC2
sudo docker-compose up -d
to start containers.Verify Deployment