This repository contains the source code needed to build the Lambda Node.js runtime that I've described on my blog.
To build the smallest image possible, that is described and tested at the end of the article, you can use the default flake output:
nix build To load the image into docker, use the following command:
docker load -i $(nix build --print-out-paths)You can also build any other intermediate step that is described in the blog post. Use nix flake show to see all
available outputs. The naming uses the following schema:
[node]-[intl]-[locales]-[rie]
nodeis eitherslimorfulland controls whether the full or slim nixpkgs node.js package is used.intlis eitherintlorno-intland controls whether node is compiled withIntlsupport.localesis eitherlocalesorno-localesand controls whether the locales are stripped from the glibcrieis eitherrieorno-rieand controls whether the Lambda Runtime Interface Emulator is included to allow for local execution of the image.
$ nix flake show
├───formatter
│ ├───[omitted]
│ └───x86_64-linux: package 'alejandra-3.0.0'
└───packages
├───[omitted]
└───x86_64-linux
├───default: package 'docker-image-node_slim_no-intl_no-locales_no-rie.tar.gz'
├───full_intl_locales_no-rie: package 'docker-image-node_full_intl_locales_no-rie.tar.gz'
├───full_intl_locales_rie: package 'docker-image-node_full_intl_locales_rie.tar.gz'
├───full_intl_no-locales_no-rie: package 'docker-image-node_full_intl_no-locales_no-rie.tar.gz'
├───full_intl_no-locales_rie: package 'docker-image-node_full_intl_no-locales_rie.tar.gz'
├───full_no-intl_locales_no-rie: package 'docker-image-node_full_no-intl_locales_no-rie.tar.gz'
├───full_no-intl_locales_rie: package 'docker-image-node_full_no-intl_locales_rie.tar.gz'
├───full_no-intl_no-locales_no-rie: package 'docker-image-node_full_no-intl_no-locales_no-rie.tar.gz'
├───full_no-intl_no-locales_rie: package 'docker-image-node_full_no-intl_no-locales_rie.tar.gz'
├───minimal: package 'docker-image-node_slim_no-intl_no-locales_no-rie.tar.gz'
├───slim_intl_locales_no-rie: package 'docker-image-node_slim_intl_locales_no-rie.tar.gz'
├───slim_intl_locales_rie: package 'docker-image-node_slim_intl_locales_rie.tar.gz'
├───slim_intl_no-locales_no-rie: package 'docker-image-node_slim_intl_no-locales_no-rie.tar.gz'
├───slim_intl_no-locales_rie: package 'docker-image-node_slim_intl_no-locales_rie.tar.gz'
├───slim_no-intl_locales_no-rie: package 'docker-image-node_slim_no-intl_locales_no-rie.tar.gz'
├───slim_no-intl_locales_rie: package 'docker-image-node_slim_no-intl_locales_rie.tar.gz'
├───slim_no-intl_no-locales_no-rie: package 'docker-image-node_slim_no-intl_no-locales_no-rie.tar.gz'
└───slim_no-intl_no-locales_rie: package 'docker-image-node_slim_no-intl_no-locales_rie.tar.gz'
For example, use nix build .#slim_intl_locales_rie to build the image using the slim Node.js package,
with Intl support, locales and local execution support.