Install Node.js

If you need a specific version of Node.js on an image other than the tugboatqa/node image, we recommend using NodeSource distributions to do so. The majority of Tugboat images are Debian-based.

For example, to install Node.js version 18.x on a PHP service:

 1services:
 2  php:
 3    image: tugboatqa/php:8
 4    commands:
 5      init:
 6        - apt-get update
 7        - apt-get install -yq ca-certificates curl gnupg
 8        - mkdir -p /etc/apt/keyrings
 9        - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o
10          /etc/apt/keyrings/nodesource.gpg
11        - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" |
12          tee /etc/apt/sources.list.d/nodesource.list
13        - apt-get update
14        - apt-get install -yq nodejs