diff --git a/templates/build_enstools.sh b/templates/build_enstools.sh
new file mode 100644
index 0000000000000000000000000000000000000000..7c6c2bb8ceb6652c5a4242bec8d4c0bdcecb8679
--- /dev/null
+++ b/templates/build_enstools.sh
@@ -0,0 +1,40 @@
+# Get some variables provided by autosubmit.
+# TODO: What do we do to ensure that these variables are defined in the proj file?
+WORKDIR=%HPCROOTDIR%
+ICON_VERSION=%ICON_VERSION%
+SPACK_URL=%spack.url%
+SPACK_BRANCH=%spack.branch%
+SPACK_COMPILER=%spack.compiler%
+
+
+# If the workdir directory does not exist create it
+if [ ! -d ${WORKDIR} ] ; then
+        mkdir -p ${WORKDIR}
+fi
+
+# Go to the working directory
+cd ${WORKDIR}
+
+# Check if experiment's spack installation already exists, if it doesn't, clone it.
+SPACK_ENV=spack/share/spack/setup-env.sh
+if [ ! -f ${SPACK_ENV} ] ; then
+  git clone ${SPACK_URL} -b ${SPACK_BRANCH}
+  #TODO: Would be good to enable the re-utilization of existing spack packages (via packages.yaml or upstreams.yaml)
+fi
+
+# Setup the environment
+source ${SPACK_ENV}
+
+
+if [ $( spack find py-enstools-compression &> /dev/null ; echo $? ) -ne 0 ]; then
+        echo "Installing enstools-compression."
+        # Compile openmpi with schedulers=slurm
+        spack install py-enstools-compression
+else
+        echo "py-enstools-compression already installed!"
+fi
+
+# Link the python binary into the main folder so can be easily used later:
+
+spack load py-enstools-compression
+ln -sf $(which python3) ${WORKDIR}/python3
\ No newline at end of file