-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
42 lines (33 loc) · 968 Bytes
/
deploy.sh
File metadata and controls
42 lines (33 loc) · 968 Bytes
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
#!/usr/bin/env bash
# enable GCP apis
gcloud services enable appengine.googleapis.com
export APP_NAME="Aspen-Nft-Dapp"
export PROJECT_ID="aspenlab"
cd aspendreact
# bootstrap app using create-react-app
# install app
npm install
npm audit fix # just in case vulnerabilities
# test it works, view in browser, then CTRL+C
npm start
# build app for production (creates build/ folder)
npm build
# create app engine config file (app.yaml)
cat > app.yaml << EOF
env: standard
runtime: nodejs10
service: app-engine-react-demo
handlers:
- url: /static
static_dir: build/static
- url: /(.*\.(json|ico|js))$
static_files: build/\1
upload: build/.*\.(json|ico|js)$
- url: .*
static_files: build/index.html
upload: build/index.html
EOF
# deploy app to app engine (if first deploy potentially select region)
gcloud app deploy --project=$PROJECT_ID --quiet
# wait several minutes then visit the URL provided in output
gcloud app browse -s $APP_NAME