2021-10-06 23:04:38 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
|
|
|
APP_FOLDER=info
|
2021-10-17 17:55:24 -05:00
|
|
|
CONTAINER_NAME=werefox-dev
|
2021-10-06 23:04:38 -05:00
|
|
|
|
|
|
|
MODE=$1
|
2022-12-05 19:51:43 -06:00
|
|
|
x=$(APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose ps | grep $CONTAINER_NAME | wc -l)
|
|
|
|
|
|
|
|
if [ "$MODE" == "" ]; then
|
|
|
|
echo "Please use 'dev', 'build', or 'start' as an argument."
|
|
|
|
exit 1
|
2021-10-06 23:04:38 -05:00
|
|
|
fi
|
|
|
|
|
2022-12-05 19:51:43 -06:00
|
|
|
if [ $x -eq 1 ]; then
|
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose rm -sf
|
|
|
|
fi
|
2021-10-06 23:04:38 -05:00
|
|
|
|
2022-12-05 19:51:43 -06:00
|
|
|
if [ ! -d "$(pwd)/src/$APP_FOLDER" ]; then
|
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npm install --silent create-next-app && \
|
|
|
|
npx create-next-app /usr/src/app/$APP_FOLDER --ts --eslint && \
|
|
|
|
cd $APP_FOLDER && npm install tailwindcss autoprefixer && npx tailwindcss init -p && \
|
|
|
|
cd /usr/src/app && rm -rf node_modules package.json package-lock.json"
|
2021-10-06 23:04:38 -05:00
|
|
|
fi
|
|
|
|
|
2022-12-05 19:51:43 -06:00
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "cd $APP_FOLDER && npm install --silent"
|
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "cd $APP_FOLDER && npx next telemetry disable"
|
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose up -d
|
2021-10-06 23:04:38 -05:00
|
|
|
|
2022-12-05 19:51:43 -06:00
|
|
|
if [ "$MODE" == "dev" ] || [ "$MODE" == "start" ]; then
|
|
|
|
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose logs -f
|
|
|
|
fi
|