npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@openinc/dhi-bootstrap

v1.0.6

Published

Route setup and privilege dropping bootstrap for Docker Hardened Images (dhi.io)

Downloads

460

Readme

dhi-bootstrap

Route setup and privilege dropping bootstrap for Docker Hardened Images (dhi.io)

Why this is needed

Docker Hardened Images (dhi.io) are stripped-down base images designed to run applications as a non-root user. This is good for security, but it creates a problem: some container-startup tasks — like adding a network route to reach an internal VPN or private subnet — require root privileges and must happen before the application starts.

The standard workaround is to run the whole container as root, which defeats the purpose of a hardened image. dhi-bootstrap solves this by acting as a minimal init process that:

  1. Starts as root (via USER root or the default container user)
  2. Performs the privileged setup (route configuration via NET_ADMIN)
  3. Immediately drops to an unprivileged user
  4. Hands off to your application

The result is that your application process never runs as root, and the attack surface of the privileged phase is kept as small as possible.

What it does

dhi-bootstrap is a lightweight init process for Docker containers that runs as root, optionally configures network routes, drops privileges to an unprivileged user, then exec's your application. It ships as both a CLI tool and a programmatic Node.js API.

Docker usage

Use the published image as a base and set dhi-bootstrap as the entrypoint:

FROM openinc/dhi-bootstrap AS bootstrap

FROM node:24-alpine
COPY --from=bootstrap /app/bootstrap.mjs /usr/local/bin/dhi-bootstrap
ENTRYPOINT ["node", "/usr/local/bin/dhi-bootstrap"]
CMD ["node", "server.js"]

Or reference it directly in a docker-compose.yml:

services:
  app:
    image: my-app
    entrypoint: ["node", "/usr/local/bin/dhi-bootstrap", "node", "server.js"]
    environment:
      ROUTE_DESTINATION: 10.0.0.0/8
      ROUTE_GATEWAY: 172.17.0.1
      DROP_TO_USER: node
    cap_add:
      - NET_ADMIN

Environment variables

| Variable | Default | Description | |---|---|---| | ROUTE_DESTINATION | — | Destination network (e.g. 10.0.0.0/8). Route setup is skipped if unset. | | ROUTE_GATEWAY | — | Gateway IP for the route (e.g. 172.17.0.1). Route setup is skipped if unset. | | DROP_TO_USER | node | Unix user/group to drop privileges to before spawning the child process. |

CLI

dhi-bootstrap <command> [args...]

The bootstrap process:

  1. Adds the configured route via /sbin/ip route replace (requires NET_ADMIN capability)
  2. Drops process uid/gid to DROP_TO_USER
  3. Spawns <command> and forwards SIGTERM/SIGINT to it

Programmatic API

import { setupRoute, dropPrivileges } from "@openinc/dhi-bootstrap";

setupRoute({ destination: "10.0.0.0/8", gateway: "172.17.0.1" });
dropPrivileges("node");

setupRoute(options?)

Configures a network route. Falls back to ROUTE_DESTINATION / ROUTE_GATEWAY env vars if options are omitted. Exits the process if the ip route command fails.

dropPrivileges(user?)

Calls process.setgid and process.setuid to drop to the given user. Falls back to DROP_TO_USER env var, then "node". Logs a warning (but does not exit) if the call fails.