@@ -18,37 +18,32 @@ jobs:
1818
1919 build_development :
2020 docker :
21- - image : ubuntu:20.04
21+ # Change from Ubnutu to cimg/node:14.21.3.
22+ # cimg convient image comes with node, yarn, and other pre-installed software.
23+ # This will remove the steps of install node, yarn, and other software.
24+ - image : cimg/node:14.21.3
2225 resource_class : large
2326 steps :
2427 - checkout
25- - run :
26- name : Install ubuntu updates
27- command : apt-get update && apt-get upgrade -y
28- - run :
29- name : Install curl and zip
30- command : apt-get install curl zip -y
31- - run :
32- name : Download and execute Node.js 14.x install script from node source
33- command : curl -sL https://deb.nodesource.com/setup_14.x | bash -
34- - run :
35- name : Install Node.js and NPM
36- command : apt-get install nodejs -y
37- - run :
38- name : Download and execute Yarn istallation script
39- command : curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null
40- - run :
41- name : Add yarn to sources.list
42- command : echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
43- - run :
44- name : Install yarn
45- command : apt-get install yarn -y
28+ - restore_cache :
29+ keys :
30+ # Update the key to v1.1-dependencies-{{ checksum "package-lock.json" }} since the base image switched.
31+ # Otherwise, we would have persmission issues while retriving the cache saved from the preivous image
32+ - v1.1-dependencies-{{ checksum "package-lock.json" }}
4633 - run :
4734 name : Install HighestGoodNetworkApp's NodeJS dependencies
4835 command : npm install
4936 - run :
5037 name : Build the React client
5138 command : export REACT_APP_APIENDPOINT=$APIENDPOINT_DEV REACT_APP_DEF_PWD=$REACT_APP_DEF_PWD REACT_APP_SENTRY_URL=$SENTRY_URL_DEV SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=$NODE_OPTIONS && npm run build
39+ - run :
40+ name : Export error log if 'Build the React client' failed
41+ command : |
42+ mkdir -p /tmp/err_logs
43+ cp -r /home/circleci/.npm/_logs/* /tmp/err_logs
44+ when : on_fail
45+ - store_artifacts :
46+ path : /tmp/err_logs
5247 - run :
5348 name : Create ZIP archive of build directory
5449 command : zip -r build.zip build
6156 - run :
6257 name : Deploy compiled app to surge.sh on $SURGE_DOMAIN_DEV
6358 command : ./node_modules/.bin/surge --domain $SURGE_DOMAIN_DEV --project ./build
59+ - save_cache :
60+ key : v1.1-dependencies-{{ checksum "package-lock.json" }}
61+ paths :
62+ - ./node_modules
6463
6564 build_beta :
6665 docker :
0 commit comments