File size: 877 Bytes
e9e839d
 
73b316c
e9e839d
73b316c
 
 
 
e9e839d
73b316c
 
 
e9e839d
73b316c
e9e839d
 
 
 
 
 
73b316c
 
 
 
 
 
 
 
 
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
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;

if [ "$INCLUDE_DB" = "true" ] ; then
    echo "INCLUDE_DB is set to true."

    MONGODB_CONFIG="MONGODB_URL=mongodb://localhost:27017"
    if ! grep -q "^${MONGODB_CONFIG}$" ${ENV_LOCAL_PATH}; then
      echo "Appending MONGODB_URL"
      touch /app/.env.local
      echo -e "\n${MONGODB_CONFIG}" >> ${ENV_LOCAL_PATH}
    fi

    mkdir -p /data/db
    mongod &
    echo "Starting local MongoDB instance"

fi;

npm run build
npm run preview -- --host 0.0.0.0 --port 3000