You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can also add an SBOM entry for each dependency listed in `package.json`. Here we use `jq` to add a new record to the `components` array in `bundler.sbom.cdx.json`:
89
89
90
90
```bash
91
-
cnode-jsbom="${layersdir}/node-js.sbom.cdx.json"
91
+
node-jsbom="${layersdir}/node-js.sbom.cdx.json"
92
92
cat >>${node-jsbom}<<EOL
93
93
{
94
94
"bomFormat": "CycloneDX",
@@ -98,22 +98,11 @@ cat >> ${node-jsbom} << EOL
98
98
{
99
99
"type": "library",
100
100
"name": "node-js",
101
-
"version": "$node-js_version"
101
+
"version": "${node_js_version}"
102
102
}
103
103
]
104
104
}
105
105
EOL
106
-
if [[ -f package.json ]] ;then
107
-
forgemin$(gem dep -q | grep ^Gem | sed 's/^Gem //')
108
-
do
109
-
version=${gem##*-}
110
-
name=${gem%-${version}}
111
-
DEP=$(jq --arg name "${name}" --arg version "${version}" \
This code uses the `wget` tool to download the NodeJS binaries from the given URL, and extracts it to the `node_js_layer` directory.
45
+
This code uses the `wget` tool to download the NodeJS binaries from the given URL, and extracts it to the `node_js_layer` directory. We use `tar` to extract the NodeJS distribution into the `node_js_layer`. During the extraction we remove the top level directory (i.e. `--strip-components 1`). This means that we will end up with `${node_js_layer}/bin` and `${node_js_layer}/lib`. When starting the container the layers `bin` will automatically be added to the runtime `${PATH}`.
46
46
47
47
The last step in creating a layer is writing a TOML file that contains metadata about the layer. The TOML file's name must match the name of the layer (in this example it's `node-js.toml`). Without this file, the Buildpack lifecycle will ignore the layer directory. For the NodeJS layer, we need to ensure it is available in the launch image by setting the `launch` key to `true`. Add the following code to the build script:
0 commit comments