-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-entrypoint.sh
50 lines (44 loc) · 1.26 KB
/
docker-entrypoint.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
#!/bin/bash
# Expects following environment variables to be populated:
# DEPLOY_ENV, CONFIG_JS (optional)
set -e
# check that required environment variables are set
if [[ -z ${DEPLOY_ENV+x} ]]; then
echo "DEPLOY_ENV environment variable must be set. Exiting."
exit 1
fi
echo "Running application in [${DEPLOY_ENV}] environment"
if [[ "${DEPLOY_ENV}" == "travis" || "${DEPLOY_ENV}" == "test" ]]; then
if [[ -n ${CC_TEST_REPORTER_ID+x} ]]; then
npm run cov:before
fi
cp src/config.js.example src/config.js
npm run lint
npm run babel
npm run test
if [[ -n ${CC_TEST_REPORTER_ID+x} ]]; then
npm run cov:after
fi
else
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false npm install
cp src/config.js.example src/config.js
# Create config.js from environment if set.
if [[ "${CONFIG_JS}" != "" ]]; then
WORKTMP=$(mktemp)
echo ${CONFIG_JS} | base64 -d > $WORKTMP
if (( $? != 0 )); then
echo "Error: could not decode CONFIG_JS ENV var: ${CONFIG_JS} . Using defaults."
rm $WORKTMP
else
echo "Using decoded CONFIG_JS from ENV var: ${CONFIG_JS} ."
mv $WORKTMP src/config.js
sha1sum src/config.js
fi
fi
npm run lint
npm run babel
cp -r node_modules dist
SLOWMO_MS=250 node dist/local.js
fi
echo "$@"
exec "$@"