To run the application locally without Docker (development mode with hot reload):
npm install
npm run start:devThis will run the application directly on your machine and reflect code changes immediately.
To run the application in development mode with hot reload inside Docker:
docker build -t perf-monitoring-dev --target dev .
docker run -p 4432:4432 --name perf-dev -v $(pwd):/app -d perf-monitoring-devThe volume
-v $(pwd):/appensures that changes in your local code are immediately reflected inside the container.
To run the application in production mode:
docker build -t perf-monitoring-prod --target runtime .
docker run -p 4432:4432 --name perf-prod -d perf-monitoring-prodThe production version only uses the compiled files in
dist/and installs production dependencies, resulting in a smaller and faster image.
After running the container or starting locally, open in your browser or Postman:
http://localhost:4432
You can access the monitoring tools at their default ports:
- Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000
Dockerfile(orDockerfile.dev/Dockerfile.prod).dockerignore(to ignorenode_modules,dist, and sensitive files)package.json/package-lock.json- NestJS source code (
src/)
- For faster future builds, Docker uses layer caching (
npm installand build). - Do not upload
node_modulesordist/to GitHub; use.dockerignore. - Next steps would be to add Prometheus and Grafana to Docker, but that can be done later.