HUB
Sign inSign up

lulzon/node:latest

Languages & frameworks
Manifest digest

sha256:92729e444ccf889751ab84af7637ad50f93f6b211fa6d8821a0c9a3fbd5c5724

Last pushed

12 days by lulzon

Type

Sandbox Kit

Manifest digest

sha256:92729e444ccf889751ab84af7637ad50f93f6b211fa6d8821a0c9a3fbd5c5724

yaml
schemaVersion: "3"
displayName: Node.js
author: Nick Lozon <[email protected]>
description: Install Node.js as a mixin
sourceUrl: https://github.com/nicklozon/sbx-node-mixin
kind: mixin
capabilities:
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                set -eu
                NODE_VERSION='${{ kit.args.version }}'

                case "$(uname -m)" in
                  x86_64) arch=x64 ;;
                  aarch64|arm64) arch=arm64 ;;
                  *) echo "nodejs.org publishes no $(uname -m) binaries" >&2; exit 1 ;;
                esac

                name="node-v${NODE_VERSION}-linux-${arch}"
                curl -fsSL -o /tmp/node.tar.gz "https://nodejs.org/dist/v${NODE_VERSION}/${name}.tar.gz"

                # The base image may already ship a Node. Extracting over it would leave the old
                # npm files behind, so clear them first.
                rm -rf /usr/local/lib/node_modules/npm /usr/local/include/node
                tar -xzf /tmp/node.tar.gz --strip-components=1 -C /usr/local \
                  --exclude="${name}/CHANGELOG.md" --exclude="${name}/LICENSE" --exclude="${name}/README.md"
                rm -f /tmp/node.tar.gz
              user: "0"
    - type: com.docker.sandbox/network-policy@1
      config:
        install:
            allow:
                - nodejs.org:443
        runtime:
            allow:
                - registry.npmjs.org:443
args:
    version:
        default: 22.22.1
        description: Release to install, as published by nodejs.org.
        pattern: ^[0-9]+\.[0-9]+\.[0-9]+$