2025-10-26 14:22:02 +00:00
# 🐳 ht-docker-node
2026-02-07 10:43:46 +00:00
> Production-ready Docker images for Node.js with NVM built in, multi-arch support, and modern runtimes (Bun, Deno). Every image ships with **tini** as PID 1 and full **NVM** integration — switch Node versions on the fly, no sourcing required.
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
**Multi-arch** • **Alpine & Ubuntu ** • **NVM built-in ** • **Bun, Deno & pnpm ** • **tini init ** • **CI/CD optimized **
## Issue Reporting and Security
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/ ](https://community.foss.global/ ). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/ ](https://code.foss.global/ ) account to submit Pull Requests directly.
2025-10-26 14:22:02 +00:00
---
## 🚀 Quick Start
```bash
2026-02-07 10:43:46 +00:00
# Pull and run the full-featured Ubuntu image
docker pull code.foss.global/host.today/ht-docker-node:latest
docker run -it code.foss.global/host.today/ht-docker-node:latest
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Or go lean with Alpine (~200 MB vs ~900 MB)
docker pull code.foss.global/host.today/ht-docker-node:alpine-node
docker run -it code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
NVM is ready the moment you enter the container — no manual sourcing, no `.bashrc` hacks:
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
```bash
$ nvm install 22
$ nvm use 22
$ node -v # v22.x.x ✅
```
---
## 📦 Available Images
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
### Ubuntu-Based (Full-Featured)
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
Built on **Ubuntu 24.04 ** . Maximum compatibility, all build tools included, plus Chromium for Puppeteer/Playwright, and MongoDB 8.0.
2026-02-06 14:00:03 +00:00
2026-02-07 10:43:46 +00:00
| Tag | Description | Key Contents |
|-----|-------------|--------------|
| `:latest` | Kitchen-sink Node.js image | Node LTS + NVM + pnpm + Bun + Deno + Chromium + MongoDB 8.0 |
| `:lts` | Alias of `:latest` | Same — explicit LTS naming for clarity |
| `:szci` | CI/CD workhorse | `:latest` + `@ship.zone/szci` preinstalled |
| `:fossglobal_preinstalled_<ver>` | Preloaded tooling image | `:szci` + tsrun, tstest, tapbundle, smartfile, and more |
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
### Alpine-Based (Lightweight & Multi-Arch) ⚡
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
**40– 75 % smaller** than Ubuntu. Native performance on **both amd64 and arm64 ** (Apple Silicon, Graviton, Ampere).
2025-10-26 14:22:02 +00:00
| Tag | Description | Size | Architectures |
|-----|-------------|------|---------------|
2026-02-07 10:43:46 +00:00
| `:alpine-node` | Node.js LTS + NVM + pnpm | ~200 MB | amd64, arm64 |
| `:alpine-bun` | Node.js LTS + NVM + Bun | ~150 MB | amd64, arm64 |
| `:alpine-deno` | Node.js LTS + NVM + Deno | ~180 MB | amd64, arm64 |
| `:alpine-szci` | Alpine Node + szci + build tools | ~250 MB | amd64, arm64 |
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
> 💡 Docker automatically pulls the right arch for your platform. Build on a Mac, deploy on an ARM server — same tag, native speed everywhere.
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
> **Note:** The Deno Alpine image uses `alpine:edge` to get the official musl-compiled Deno from the community repository.
### What every image includes
| Feature | Detail |
|---------|--------|
| **tini ** | PID 1 init — proper signal forwarding & zombie reaping |
| **NVM ** | v0.40.1 — works in `RUN` , `docker exec` , CI scripts, interactive shells |
| **Node.js ** | LTS v24.13.0 (default, switchable) |
| **docker-entrypoint.sh ** | Loads NVM at runtime so `docker run … bash -c "nvm use 22"` just works |
2025-10-26 14:22:02 +00:00
---
## 💡 Key Features
2026-02-07 10:43:46 +00:00
### 🔄 NVM — Zero-Config Node Version Management
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
NVM is pre-wired into every shell context. No manual sourcing required in any of these scenarios:
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
**Dockerfile RUN commands** (via the `bash-with-nvm` SHELL wrapper):
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
```dockerfile
FROM code.foss.global/host.today/ht-docker-node:latest
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Works directly — no sourcing needed!
RUN nvm install 22 && nvm use 22 && npm ci
RUN nvm alias default 22 # persists for later RUN steps
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
**CI/CD scripts** (via `BASH_ENV=/etc/bash.bashrc` ):
2025-10-26 14:22:02 +00:00
```yaml
2026-02-07 10:43:46 +00:00
# Gitea / GitLab CI
2025-10-26 14:22:02 +00:00
test:
2026-02-07 10:43:46 +00:00
image: code.foss.global/host.today/ht-docker-node:latest
2025-10-26 14:22:02 +00:00
script:
2026-02-07 10:43:46 +00:00
- nvm install 22 && nvm use 22
- pnpm ci && pnpm test
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
**Interactive shells** and * * `docker exec` **:
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
```bash
docker exec -it mycontainer bash
$ nvm ls # lists installed versions
$ nvm install 20 # installs Node 20
$ nvm use 20 # switches immediately
```
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
> ⚠️ **Note on version persistence across RUN steps:** Each Dockerfile `RUN` starts a new shell. Use `nvm alias default <version>` to persist your choice, or chain commands in a single `RUN`.
### 🛡️ tini — Proper Init for Containers
All images use [tini ](https://github.com/krallin/tini ) as PID 1:
```
tini → docker-entrypoint.sh → your command
```
This means:
- ✅ Signals (SIGTERM, SIGINT) are forwarded correctly to your app
- ✅ Zombie processes are reaped automatically
- ✅ Clean container shutdown — no orphaned processes
### 🌐 Chromium (Ubuntu `:latest` only)
Puppeteer and Playwright work out of the box:
```javascript
const browser = await puppeteer.launch(); // uses /usr/bin/chromium-browser
```
Environment variables `PUPPETEER_EXECUTABLE_PATH` and `CHROME_BIN` are pre-set. Multi-arch compatible (amd64 + arm64).
### 🏔️ Alpine — Production Optimized
```dockerfile
FROM code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
RUN nvm install 22 && nvm use 22
RUN pnpm install && pnpm build
# Result: ~200 MB image
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
Why Alpine?
- ✅ **60– 75 % smaller ** → Faster pulls, faster deploys
- ✅ **Reduced attack surface ** → Fewer packages = fewer CVEs
- ✅ **Native musl builds ** → No glibc compatibility layer
- ✅ **Multi-arch ** → Same tag works on x64 and ARM64
2025-10-26 14:22:02 +00:00
---
## 🛠️ Usage Examples
2026-02-07 10:43:46 +00:00
### Basic Node.js App
2025-10-26 14:22:02 +00:00
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY package*.json ./
RUN pnpm install
COPY . .
RUN pnpm build
EXPOSE 3000
CMD ["node", "dist/index.js"]
```
### Multi-Version Testing
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:latest
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY package*.json ./
RUN nvm install 20 && nvm use 20 && npm ci && npm test
2026-02-07 10:43:46 +00:00
RUN nvm install 22 && nvm use 22 && npm ci && npm test
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Ship with Node 22
RUN nvm alias default 22 && npm run build
2025-10-26 14:22:02 +00:00
```
### Deno Application
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-deno
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY . .
2026-02-07 10:43:46 +00:00
# Deno and Node.js are both available
2025-10-26 14:22:02 +00:00
CMD ["deno", "run", "--allow-net", "main.ts"]
```
2026-02-07 10:43:46 +00:00
### Bun for Ultra-Fast Installs
2025-10-26 14:22:02 +00:00
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-bun
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install
COPY . .
RUN bun run build
CMD ["bun", "run", "start"]
```
2026-02-07 10:43:46 +00:00
### TypeScript Multi-Stage Build
2025-10-26 14:22:02 +00:00
```dockerfile
# Build stage
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-node AS builder
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY package*.json ./
RUN pnpm install
COPY tsconfig.json ./
COPY src ./src
RUN pnpm build
2026-02-07 10:43:46 +00:00
# Production stage — only runtime deps
FROM code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
WORKDIR /app
COPY package*.json ./
RUN pnpm install --prod
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/index.js"]
```
2026-02-07 10:43:46 +00:00
### Production-Hardened Setup
2025-10-26 14:22:02 +00:00
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
WORKDIR /app
COPY package*.json ./
RUN pnpm install --frozen-lockfile && pnpm cache clean
COPY --chown=nodejs:nodejs . .
RUN pnpm build
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
USER nodejs
EXPOSE 3000
CMD ["node", "dist/index.js"]
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
---
## 🔧 NVM Cheat Sheet
2025-10-26 14:22:02 +00:00
```bash
2026-02-07 10:43:46 +00:00
# Install a specific version
nvm install 22.5.0
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Use a version (current shell)
nvm use 22
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Set default (persists across shells / RUN steps)
nvm alias default 22
2025-10-26 14:22:02 +00:00
# Install and switch to latest LTS
2026-02-07 10:43:46 +00:00
nvm install --lts && nvm use --lts
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# List installed versions
nvm ls
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Chain in a single Dockerfile RUN
RUN nvm install 22 && nvm use 22 && npm ci && npm test
2025-10-26 14:22:02 +00:00
```
---
2026-02-07 10:43:46 +00:00
## 🏗️ Building the Images
2025-10-26 14:22:02 +00:00
2026-02-06 08:45:03 +00:00
This project uses [@git.zone/tsdocker ](https://code.foss.global/git.zone/tsdocker ) for Docker image management.
2025-10-26 14:22:02 +00:00
```bash
2026-02-06 08:45:03 +00:00
# Install tsdocker
pnpm install -g @git .zone/tsdocker@latest
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
# Discover all Dockerfiles and their tags
2026-02-06 08:45:03 +00:00
tsdocker list
2025-10-26 14:22:02 +00:00
2026-02-06 08:45:03 +00:00
# Build all images (multi-arch: amd64 + arm64)
tsdocker build
2026-02-07 10:43:46 +00:00
# Run all test scripts
2026-02-06 08:45:03 +00:00
tsdocker test
# Push to a specific registry
tsdocker push code.foss.global
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
### Manual Build (single image)
2025-10-26 14:22:02 +00:00
```bash
docker buildx build \
--platform linux/amd64,linux/arm64 \
2026-02-06 08:45:03 +00:00
-f Dockerfile_alpine-node \
2025-10-26 14:22:02 +00:00
-t your-registry/your-image:alpine-node \
2026-02-07 10:43:46 +00:00
--push .
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
### Image Dependency Chain
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
Some images depend on others being in the registry first:
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
Dockerfile (:latest) ──► Dockerfile_lts (:lts)
──► Dockerfile_szci (:szci)
──► Dockerfile_fossglobal_preinstalled_* (:fossglobal_preinstalled_<ver>)
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
Dockerfile_alpine-node (:alpine-node)
──► Dockerfile_alpine-szci (:alpine-szci)
2025-10-26 14:22:02 +00:00
```
2026-02-07 10:43:46 +00:00
The standalone Alpine images (`:alpine-bun` , `:alpine-deno` ) have no registry dependencies.
2025-10-26 14:22:02 +00:00
---
2026-02-07 10:43:46 +00:00
## 📊 Image Comparison
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
| Feature | Ubuntu `:latest` | Alpine `:alpine-node` |
|---------|------------------|----------------------|
| Base Size | ~900 MB | ~200 MB |
| Build Tools | ✅ Full (gcc, g++, make, python3) | ⚠️ Install separately (`apk add build-base` ) |
| Chromium | ✅ Pre-installed | ❌ |
| MongoDB | ✅ 8.0 | ❌ |
| Runtimes | Node + Bun + Deno + pnpm | Node + pnpm |
| Compatibility | ✅ Maximum (glibc) | ✅ Good (musl) |
| Multi-arch | ✅ amd64, arm64 | ✅ amd64, arm64 |
| tini init | ✅ | ✅ |
| Best for | Complex builds, E2E tests, full-stack dev | Production, CI/CD, microservices |
2025-10-26 14:22:02 +00:00
---
## 🐛 Troubleshooting
### NVM command not found
2026-02-07 10:43:46 +00:00
Shouldn't happen in our images, but if it does:
2025-10-26 14:22:02 +00:00
```bash
export NVM_DIR="/usr/local/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
```
### Alpine native module build failures
2026-02-07 10:43:46 +00:00
Some npm packages require native build tools:
2025-10-26 14:22:02 +00:00
```dockerfile
2026-02-07 10:43:46 +00:00
FROM code.foss.global/host.today/ht-docker-node:alpine-node
2025-10-26 14:22:02 +00:00
RUN apk add --no-cache python3 make g++
RUN pnpm install
```
2026-02-07 10:43:46 +00:00
Or use `:alpine-szci` which ships with build tools pre-installed.
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
### Version not persisting across RUN steps
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
Each Dockerfile `RUN` creates a new shell. Use `nvm alias default` :
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
```dockerfile
RUN nvm install 22 && nvm alias default 22
RUN node -v # ✅ v22.x.x
```
2025-10-26 14:22:02 +00:00
---
2026-02-07 10:43:46 +00:00
## 🔗 Links
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
- **Source Code:** [code.foss.global/host.today/ht-docker-node ](https://code.foss.global/host.today/ht-docker-node )
- **NVM:** [github.com/nvm-sh/nvm ](https://github.com/nvm-sh/nvm )
- **tini:** [github.com/krallin/tini ](https://github.com/krallin/tini )
- **tsdocker:** [code.foss.global/git.zone/tsdocker ](https://code.foss.global/git.zone/tsdocker )
- **Alpine Linux:** [alpinelinux.org ](https://alpinelinux.org/ )
- **Node.js Unofficial Builds:** [unofficial-builds.nodejs.org ](https://unofficial-builds.nodejs.org/ ) (musl support)
2025-10-26 14:22:02 +00:00
---
## License and Legal Information
2026-02-07 10:43:46 +00:00
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE ](./LICENSE ) file.
2025-10-26 14:22:02 +00:00
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
2026-02-07 10:43:46 +00:00
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
2025-10-26 14:22:02 +00:00
### Company Information
Task Venture Capital GmbH
2026-02-07 10:43:46 +00:00
Registered at District Court Bremen HRB 35230 HB, Germany
2025-10-26 14:22:02 +00:00
2026-02-07 10:43:46 +00:00
For any legal inquiries or further information, please contact us via email at hello@task .vc.
2025-10-26 14:22:02 +00:00
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.