Skip to content

Automate browser based workflows with AI

Use .nvmrc and avoid installing nvm in container since we only need node & npm there. (#2499)

Asher Foafe70ec3ede4b
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 66b16be5f..5b758139a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -132,7 +132,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
- node-version: 20
+ node-version-file: .nvmrc
- name: Install Node.js dependencies
run: npm ci
diff --git a/.github/workflows/n8n-ci.yml b/.github/workflows/n8n-ci.yml
index 1a90edf76..c82143cf7 100644
--- a/.github/workflows/n8n-ci.yml
+++ b/.github/workflows/n8n-ci.yml
@@ -20,8 +20,8 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
- node-version: '20'
-
+ node-version-file: .nvmrc
+
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 000000000..5802c69cb
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+20.12.2
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 481cc96d9..55d7c8ff6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,20 +16,15 @@ RUN playwright install-deps
RUN playwright install
RUN apt-get install -y xauth x11-apps netpbm curl && apt-get clean
-# nvm env vars
-RUN mkdir -p /usr/local/nvm
-ENV NVM_DIR /usr/local/nvm
-ENV NODE_VERSION v20.12.2
-# install nvm
-RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
-# install node and npm
-RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"
-# add node and npm to the PATH
-ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/bin
-ENV PATH $NODE_PATH:$PATH
+COPY .nvmrc /app/.nvmrc
+# Install Node.js based on .nvmrc version (without nvm)
+RUN NODE_MAJOR=$(cut -d. -f1 < /app/.nvmrc) && \
+ curl --fail --silent --show-error --location https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - && \
+ apt-get install -y nodejs && \
+ apt-get clean
+
# confirm installation
-RUN npm -v
-RUN node -v
+RUN npm -v && node -v
# install bitwarden cli
RUN npm install -g @bitwarden/[email protected]
# checking bw version also initializes the bw config