tf-a: add NVM_DIR to environment

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Change-Id: I43bd0284acbb39d72232124a3834b047eaae9b92
diff --git a/bionic-amd64-tf-a-build/Dockerfile b/bionic-amd64-tf-a-build/Dockerfile
index 5c29f83..65f4622 100644
--- a/bionic-amd64-tf-a-build/Dockerfile
+++ b/bionic-amd64-tf-a-build/Dockerfile
@@ -4,10 +4,10 @@
 ENV ARMLMD_LICENSE_FILE=27000@ci.trustedfirmware.org
 
 ENV DEBIAN_FRONTEND=noninteractive
+ENV NVM_DIR=/usr/local/nvm
 ENV TOOLS_DIR=/home/buildslave/tools
 ENV PATH=${TOOLS_DIR}/bin:${PATH}
 ENV PLANTUML_JAR_PATH=/usr/share/plantuml/plantuml.jar
-ENV NVM_DIR=/usr/local/nvm
 ENV PKG_DEPS="\
     bc \
     bison \
@@ -88,13 +88,6 @@
     bash -ex /tmp/tf-environment.install ;\
     # Fix permissions
     chown -R buildslave:buildslave ${TOOLS_DIR} /usr/share/plantuml /nfs/downloads/linaro /arm ;\
-    # Install NVM
-    mkdir -p ${NVM_DIR} ;\
-    curl -s https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash ;\
-    echo ". ${NVM_DIR}/nvm.sh" >> /home/buildslave/.bashrc ;\
-    chown -R buildslave:buildslave /home/buildslave/.bashrc ;\
-    . ${NVM_DIR}/nvm.sh ;\
-    nvm install 14 ;\
     # Cleanup
     apt clean ;\
     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
diff --git a/bionic-amd64-tf-a-build/tf-dependencies.install b/bionic-amd64-tf-a-build/tf-dependencies.install
index 5618620..7d1bf04 100755
--- a/bionic-amd64-tf-a-build/tf-dependencies.install
+++ b/bionic-amd64-tf-a-build/tf-dependencies.install
@@ -68,3 +68,11 @@
   unzip -q ${file} -d $(basename ${file} .zip)
 done
 rm -f *.zip
+
+# Install NVM
+mkdir -p ${NVM_DIR}
+curl -s https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
+echo ". ${NVM_DIR}/nvm.sh" >> /home/buildslave/.bashrc
+chown -R buildslave:buildslave /home/buildslave/.bashrc
+. ${NVM_DIR}/nvm.sh
+nvm install 14
diff --git a/bionic-amd64-tf-a-build/tf-environment.install b/bionic-amd64-tf-a-build/tf-environment.install
index c1bef6f..1a66804 100755
--- a/bionic-amd64-tf-a-build/tf-environment.install
+++ b/bionic-amd64-tf-a-build/tf-environment.install
@@ -3,6 +3,7 @@
 set -e
 
 env | grep ARMLMD_LICENSE_FILE  >> /etc/environment
+env | grep NVM_DIR >> /etc/environment
 env | grep PLANTUML_JAR_PATH >> /etc/environment
 env | grep TOOLS_DIR >> /etc/environment
 env | grep PATH >> /etc/environment