-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture Deep Dive
Runtime-Node is not a standard Docker image. It is built FROM scratch. This page explains the specific engineering decisions and edge cases we solved to make Node.js run flawlessly in a void.
All core binaries and libraries are copied into the image with --chmod=555 (Read/Execute, No Write). Even if a container is accidentally run as root, the underlying filesystem fights back against modification. Your runtime is completely immutable.
By default, a scratch container does not know how to resolve domain names because it lacks OS-level routing configurations. We inject a custom /etc/nsswitch.conf file containing hosts: files dns. This ensures that Node.js functions like dns.lookup() and external database connections route correctly.
To ensure your Node.js application can make secure outgoing API requests, we bundle the latest CA certificates from Alpine. We explicitly copy both /etc/ssl/certs/ca-certificates.crt and /etc/ssl/cert.pem to prevent edge-case TLS failures in specific Node fetch libraries that hardcode path expectations.
Standard scratch images lack the IANA Time Zone Database. This causes JavaScript Date objects, Intl.DateTimeFormat, and libraries like date-fns to behave unpredictably.
We solve this by:
- Setting
ENV TZ=UTCby default. - Injecting the full
/usr/share/zoneinfodatabase, allowing you to seamlessly override theTZenvironment variable in yourdocker-compose.ymlto any global timezone.
Standard Node.js runs unpredictably in production if NODE_ENV is not set to production, that's why the NODE_ENV is set to production by default.
Many Node.js frameworks (and native tools) require a writable temporary directory to process file uploads or buffer memory. We provision an empty /tmp directory with the standard 1777 sticky-bit permissions (meaning anyone can write to it, but only the file owner can delete their files).
(Note: For maximum security, we recommend mounting /tmp as a tmpfs volume in your RAM in runtime configuration and to make sure to not allow any execution).
Runtime Node • Secure, Distroless, Multi-Arch Node.js Runtime
Released under the Apache 2.0 License.
Star on GitHub • Docker Hub • GitHub Container Registry (GHCR) • Report an Issue