Overview
The three kinds of function, what each expects from your source tree, and how the image is built.
A function's kind is chosen when it is created and cannot be changed afterwards. It decides how the source tree is read, what is built, and which settings apply.
Node.js
Anything with a package.json.
Go
Anything with a go.mod.
Static
Anything with an index.html. No container, no cold start.
What is common
No Dockerfile. Build recipes come from fixed per-language templates. You supply source, optionally a list of Debian packages, and optionally an entrypoint — never a build command.
Layer ordering is chosen for you. Manifest and lockfile are copied first, the dependency install runs against them, and only then is the rest of your source copied in. That is why a code-only change rebuilds in seconds while a dependency change does not.
$PORT is the contract. Node.js and Go functions must listen on the port in
$PORT (8080 unless you override it). The readiness probe watches the same
number.
Builds are cached by content. An unchanged recipe over unchanged source does not rebuild, which is also why the system-package list is sorted and deduplicated before it is used: reordering the same packages must not miss the cache.
Which settings apply
| Setting | Static | Node.js | Go |
|---|---|---|---|
| Static directory | ✓ | — | — |
| Go main package | — | — | ✓ |
| Port, entrypoint, system packages | — | ✓ | ✓ |
| Environment variables, secrets | — | ✓ | ✓ |
| Scaling | — | ✓ | ✓ |
Settings that do not apply are hidden in the console and refused by the API. A static function is served from files and runs no process, so storing an environment variable for it would imply it does something.