docker-entrypoint.sh 344 Bytes
Newer Older
BoHong Li's avatar
BoHong Li committed
1
#!/usr/bin/env bash
2
3
4

set -euo pipefail

BoHong Li's avatar
BoHong Li committed
5
6
7
8
9
10
if [[ "$#" -gt 0 ]]; then
    exec "$@"
    exit $?
fi

# check database and redis is ready
11
pcheck -env CMD_DB_URL
12

BoHong Li's avatar
BoHong Li committed
13
14
15
16
17
18
# run DB migrate
NEED_MIGRATE=${CMD_AUTO_MIGRATE:=true}

if [[ "$NEED_MIGRATE" = "true" ]] && [[ -f .sequelizerc ]] ; then
    npx sequelize db:migrate
fi
19

BoHong Li's avatar
BoHong Li committed
20
# start application
21
node app.js