Skip to content

Repository files navigation

docker-node-app

Docker+Node

CI GitHub top language Docker Pulls GitHub last commit Lines of code License

A sample Node.js app in Docker

  • Uses Node.js 24 LTS
  • Reproducible npm installs from the committed lockfile
  • Runs as a non-root user for enhanced security
  • Multi-stage development, test, and production images
  • Snyk dependency scanning and CodeQL security checks in CI
  • Properly handles SIGINT and SIGTERM events with tini

Local development

With Node.js 24 installed:

npm ci
npm test
npm run lint
npm run dev

Or run the development container with live source mounts:

docker compose up --build

Docker

This application is also available on Dockerhub.

To launch the container:

docker run -d -p 8080:8080 --name docker-node-app jonfairbanks/docker-node-app:latest

To verify its health:

curl --fail http://localhost:8080/healthz

Kubernetes

You can find this app on Helm!

This application can also be helpful verifying Kubernetes:

  • Scaling and Downtime Mitigation
  • Cluster Load Balancing
  • Request IP Passthrough

Validate or install the bundled chart with Helm 3:

helm lint chart
helm upgrade --install docker-node-app chart

For testing that pods are balancing correctly, you can make multiple requests to your app to verify.

To make 50 requests and write them to a file, you can run the following with your endpoint:

for run in {1..50}; do curl -sSL -D - docker-node-app.local -o /dev/null | grep X-Hostname; done

Releases

Used by

Contributors

Languages