Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Use NVM to install node

Benf05db0dde728
diff --git a/Dockerfile b/Dockerfile
index 5b1b11701..64a10aabf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,23 +31,21 @@ RUN cd /usr/src && \
python3 -m ensurepip && \
pip install --upgrade pip && \
pip --version
-RUN mkdir -p /usr/local/stow
-ENV NVM_DIR=/root/.nvm
+RUN mkdir -p /usr/local/nvm
+ENV NVM_DIR=/usr/local/nvm
ENV NODE_VERSION=16.14.2
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash && \
. "$NVM_DIR/nvm.sh" && \
nvm install v${NODE_VERSION} && \
nvm use v${NODE_VERSION} && \
nvm alias default v${NODE_VERSION}
-ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
-RUN node --version && \
- npm --version
+ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
WORKDIR /build
# Only what is needed to run the development server and run the Selenium tests
RUN mkdir -p /build/node_modules && \
- npm --unsafe-perm install \
+ npm install \
chromedriver \
express \
geckodriver \
diff --git a/tasks/buildAll.sh b/tasks/buildAll.sh
index 80bde63a9..ca0ee1dc3 100755
--- a/tasks/buildAll.sh
+++ b/tasks/buildAll.sh
@@ -1,27 +1,18 @@
#!/bin/bash
+BASE=$(dirname "$0")/..
# Bash commands to run in Bamboo to prepare an rpm for deployment
# Overwrite the placeholder config in the RPM directory with the actual
# bit.ly configuration
cp bitly.json rpm/bitly.json
-
# Bamboo automatically sets NODE_ENV to production. Override this so that
# devDependencies are installed.
-npm config set user 0
-npm config set unsafe-perm true
-export npm_config_unsafe_perm=true
-npm install --production=false --ignore-scripts
-# npm run python
-./tasks/pythonInstall.sh linux
-# npm run dist:container
-pipenv run npm run dist:bamboo
-node ./tasks/dist.js
-# build RPM
-node rpm/buildRPM.js
+npm ci --production=false --ignore-scripts
+$BASE/tasks/pythonInstall.sh linux
+pipenv run bash $BASE/tasks/distExplict.sh
+node $BASE/rpm/buildRPM.js
# This is where bamboo expects to find artifacts
-mv ~/rpmbuild build/rpm
-
-
+mv ~/rpmbuild build/rpm
\ No newline at end of file
diff --git a/tasks/distExplict.sh b/tasks/distExplict.sh
new file mode 100644
index 000000000..036f85bec
--- /dev/null
+++ b/tasks/distExplict.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+BASE=$(dirname "$0")/..
+# Replacement of npm run dist
+# Needed for bamboo to avoid
+# permission errors with npm
+node $BASE/tasks/clean.js
+FETCH_GC=1 $BASE/tasks/buildOptions.sh
+$BASE/tasks/buildOptions.sh
+node $BASE/tasks/config.js
+NODE_ENV=production npx webpack
+node $BASE/tasks/dist.js