-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·51 lines (39 loc) · 1.28 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
# Site build script
#
# This file should contain all necessary steps to build the website. Include here
# all necessary build steps (e.g. scripts minification, styles compilation etc).
#
CWD=$(pwd)
PROJECT_NAME="NEOS-PROTOBREW-DISTRIBUTION"
SITE_PACKAGE_DIR="${CWD}/Packages/Sites/Pb.Site"
function buildSitePackage() {
echo "Building Pb.Site..."
cd $SITE_PACKAGE_DIR
# Initialise NVM
set +u && source $NVM_DIR/nvm.sh && nvm install && nvm use
npm install --unsafe-perm # --unsafe-perm required to call postinstall script, when executed as root user
npm run build:prod
cd $CWD
}
case $@ in
#
# This is called when container is being build (and this script is called with --post-build param)
#
*--post-build*)
echo && echo "$PROJECT_NAME BUILD SCRIPT: POST-BUILD"
set -e # exit with error if any of the following fail
buildSitePackage
;;
#
# This is called when container launches (and script is called without param)
#
*)
echo && echo "$PROJECT_NAME BUILD SCRIPT"
git config --global user.email "[email protected]" && git config --global user.name "WWW User"
# Build site package, if needed.
[ "${T3APP_ALWAYS_DO_PULL^^}" = TRUE ] && buildSitePackage
echo "Done."
esac
echo "$PROJECT_NAME BUILD SCRIPT completed."