-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·77 lines (52 loc) · 1.29 KB
/
entrypoint.sh
File metadata and controls
executable file
·77 lines (52 loc) · 1.29 KB
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
71
72
73
74
75
76
77
#!/bin/bash
set -e
function does_db_exist() {
psql -U $PG_USER -h $PG_HOST -lqt | cut -d \| -f 1 | grep -wq $1
}
function ready() {
echo -e "##############################################"
echo -e "########### Build Complete ###################"
echo -e "##############################################"
}
function db_setup() {
DB_NAME="vendure"
sleep 10 # wait for db to be up
export PGPASSWORD=$PG_PASS
if does_db_exist $DB_NAME
then
echo -e "$DB_NAME db exists, skipping create"
else
echo -e "$DB_NAME db does not exist, creating"
psql -U $PG_USER -h $PG_HOST -c "CREATE DATABASE vendure ENCODING = 'UTF8';"
fi
cd /app/vendure/packages/dev-server/
yarn populate
}
function versions() {
echo -e "### node version ###"
node -v
echo -e "### yarn version ###"
yarn -v
echo -e "### npm version ###"
npm -v
}
function build() {
FILE=/app/vendure/package.json
if [ ! -f "$FILE" ]; then
echo -e "vendure source code repo not found."
echo -e "did you clone it correctly?"
exit 2
fi
cd /app/vendure/
echo -e ">>> step 1"
yarn
echo -e ">>> step 2"
yarn bootstrap
echo -e ">>> step 3"
yarn build
}
versions
build
db_setup
ready
exec "$@"