-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·70 lines (60 loc) · 2.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# echo "newuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# useradd -m -p encryptedPassword newuser
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y gcc g++ make python python-pip wget build-essential curl file git nodejs
# su - newuser -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"'
# su - newuser -c "/usr/local/bin/brew install node"
# su - newuser -c "/usr/local/bin/brew install [email protected]"
wget -O /tmp/go1.10.2.linux-amd64.tar.gz https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
tar -xzf /tmp/go1.10.2.linux-amd64.tar.gz
mv ./go /usr/lib/
export GOPATH=/root/go
/usr/lib/go/bin/go get google.golang.org/appengine
/usr/lib/go/bin/go get cloud.google.com/go/datastore
/usr/lib/go/bin/go get google.golang.org/api/cloudkms/v1
/usr/lib/go/bin/go get google.golang.org/appengine/log
/usr/lib/go/bin/go get golang.org/x/crypto/bcrypt
/usr/lib/go/bin/go get go.opencensus.io/trace
/usr/lib/go/bin/go get github.com/patrickmn/go-cache
/usr/lib/go/bin/go get -u -v "github.com/patrickmn/go-cache"
/usr/lib/go/bin/go get github.com/prometheus/client_golang/prometheus
git clone https://github.com/BaReinhard/gamify-halloween
mkdir -p /root/go/src/github.com/bareinhard/gamify-halloween
cp -R gamify-halloween/* /root/go/src/github.com/bareinhard/gamify-halloween/
SHA=$(git rev-parse --short origin/$CIRCLE_BRANCH)
pip install jinja2
if [ "$CIRCLE_BRANCH" = "master" ];
then
echo "Starting Production Build"
export PROJECT_ID=heph-core
export [email protected]
export REACT_APP_HOST_URL=https://gamifyhalloween.com
echo $PROD_KEY_FILE > ./server/key.json
elif [ "$CIRCLE_BRANCH" = "development" ];
then
echo "Starting Development Build"
export PROJECT_ID=heph-core-dev
export [email protected]
export REACT_APP_HOST_URL=https://heph-core-dev.appspot.com
echo $DEV_KEY_FILE > ./server/key.json
else
echo "Build Not Supported for this branch"
fi
cd frontend
npm install
npm run build && rm -Rf ../server/static && cp -R build ../server/static
cd ..
python -c 'import os
import sys
import jinja2
sys.stdout.write(
jinja2.Template(sys.stdin.read()
).render(env=os.environ))' < ./templates/app.jinja > ./server/app.yaml
gcloud auth activate-service-account --key-file=./server/key.json
gcloud --quiet config set project $PROJECT_ID
gcloud --quiet config set account $ACCOUNT
echo y | gcloud app deploy ./server/app.yaml \
--project=$PROJECT_ID \
--account=$ACCOUNT \
--version=$SHA