-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathentrypoint.sh
executable file
·63 lines (52 loc) · 1.82 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e
set -x
set -o pipefail
ENV_LOCAL_PATH=/app/.env.local
if test -z "${DOTENV_LOCAL}" ; then
if ! test -f "${ENV_LOCAL_PATH}" ; then
echo "DOTENV_LOCAL was not found in the ENV variables and .env.local is not set using a bind volume. We are using the default .env config."
fi;
else
echo "DOTENV_LOCAL was found in the ENV variables. Creating .env.local file."
cat <<< "$DOTENV_LOCAL" > ${ENV_LOCAL_PATH}
fi;
touch ${ENV_LOCAL_PATH}
if ! grep -q "^${MONGODB_URL}$" ${ENV_LOCAL_PATH}; then
if test -z "${MONGODB_URL}" ; then
echo "Error: Missing MONGODB_URL from environment, see README.md for more information. Make sure to have a replica-set-enabled MongoDB.";
exit 1;
fi;
fi
if ! grep -q "^${S3_BUCKET}$" ${ENV_LOCAL_PATH}; then
if test -z "${S3_BUCKET}" ; then
echo "Error: Missing S3_BUCKET from environment, see README.md for more information";
exit 1;
fi;
fi
if ! grep -q "^${S3_ENDPOINT_URL}$" ${ENV_LOCAL_PATH}; then
if test -z "${S3_ENDPOINT_URL}" ; then
echo "Error: Missing S3_ENDPOINT_URL from environment, see README.md for more information";
exit 1;
fi;
fi
if ! grep -q "^${S3_REGION}$" ${ENV_LOCAL_PATH}; then
if test -z "${S3_REGION}" ; then
echo "Error: Missing S3_REGION from environment, see README.md for more information";
exit 1;
fi;
fi
if ! grep -q "^${S3_KEY_ID}$" ${ENV_LOCAL_PATH}; then
if test -z "${S3_KEY_ID}" ; then
echo "Error: Missing S3_KEY_ID from environment, see README.md for more information";
exit 1;
fi;
fi
if ! grep -q "^${S3_KEY_SECRET}$" ${ENV_LOCAL_PATH}; then
if test -z "${S3_KEY_SECRET}" ; then
echo "Error: Missing S3_KEY_SECRET from environment, see README.md for more information";
exit 1;
fi;
fi
ORIGIN="${ORIGIN:-http://localhost:3000}" PUBLIC_VERSION=$(cat ./.git-commit-hash) pnpm run build
PORT=3000 node --enable-source-maps build/index.js