Lightweight, secure, and optimized Node.js 22 LTS images built on Alpine Linux.
Production-ready Node.js 22 images with multi-stage builds for production, development, and testing.
- Node.js 22 LTS on Alpine Linux
- Minimal runtime, non-root user (
node:node) - Hardened npm config for production
- Health check and graceful shutdown entrypoint
- All production features
- TypeScript toolchain (
tsc,ts-node) - Hot reload with
nodemon - Process manager with
pm2 - Build tools: git, make, g++, python3, curl
- Debug port
9229exposed
- All development features
- Vitest + coverage tooling
- Pre-created
~/test-results/and~/coverage/directories
# Pull and run
docker run -d --name node-app -p 3000:3000 zairakai/node:latest node server.js| Version | Production | Development | Test |
|---|---|---|---|
| Major | zairakai/node:22-prod |
zairakai/node:22-dev |
zairakai/node:22-test |
| Latest | zairakai/node:latest |
zairakai/node:latest-dev |
zairakai/node:latest-test |
# docker-compose.yml
services:
node:
image: zairakai/node:latest
volumes:
- ./dist:/app/dist
environment:
- NODE_ENV=productionservices:
node:
image: zairakai/node:latest-dev
volumes:
- ./app:/app
ports:
- "3000:3000"
- "9229:9229"
environment:
- NODE_ENV=development
command: npm run devservices:
frontend:
image: zairakai/node:22-dev
working_dir: /app
volumes:
- ./frontend:/app
ports:
- "3000:3000"
- "9229:9229"
command: npm run dev
backend:
image: zairakai/php:latest-dev
volumes:
- ./backend:/var/www/html| Variable | Default | Description |
|---|---|---|
NODE_ENV |
production |
Node environment |
NODE_OPTIONS |
--max-old-space-size=512 |
V8 heap options |
NPM_CONFIG_CACHE |
/tmp/.npm |
npm cache location |
The image includes a health check for the Node process:
docker inspect --format='{{.State.Health.Status}}' <container-id>- Git
- Docker
- GNU Make (optional, for running tests)
This repository uses Git submodules for shared tooling. Clone with:
# Clone with submodules in one command
git clone --recurse-submodules https://gitlab.com/zairakai/dockers/node.git
# OR if already cloned without submodules
git clone https://gitlab.com/zairakai/dockers/node.git
cd node
git submodule update --init --recursiveTo update the tooling submodule to the latest version:
git submodule update --remote --merge# Build production image
docker build --target prod -t zairakai/node:local .
# Build development image
docker build --target dev -t zairakai/node:local-dev .
# Build test image
docker build --target test -t zairakai/node:local-test .# Run BATS tests (requires submodules)
make bats
# Or manually
bats tests/The project uses GitLab CI/CD with the following stages:
- Security - Secret detection
- Validate - Dockerfile linting (Hadolint), Markdown linting, Shellcheck
- Test - BATS test suite
- Build - Multi-stage Docker builds (prod/dev/test)
- Release - Automated releases with changelog
- Non-root user (
node:node, UID/GID 1000) - Alpine Linux minimal attack surface
- Trivy vulnerability scanning on every release
- GitLab Secret Detection in CI
See SECURITY.md for the security policy.
Made with ❤️ by Zairakai