werefox-cafe/start.sh

29 lines
781 B
Bash
Raw Normal View History

2021-04-17 21:38:19 -05:00
#!/bin/bash
set -xe
MODE=$1
x=$(sudo docker container ls | grep next-js | wc -l)
if [ $x -eq 1 ]; then
sudo docker-compose rm -sf
fi
sudo MODE=$MODE docker-compose build
if [ ! -d "./src/info" ]; then
sudo docker-compose run node npx create-next-app info
sudo docker-compose run node npx tailwindcss init -p
sudo chown -R $USER:$USER ./src
fi
2021-04-19 00:42:15 -05:00
if [ $MODE == "dev" ] || [ $MODE == "start" ]; then
2021-04-17 21:38:19 -05:00
sudo MODE=$MODE docker-compose up --build --force-recreate --remove-orphans -d
sudo docker-compose logs -f
2021-04-19 00:42:15 -05:00
elif [ $MODE == "build" ]; then
sudo docker-compose run node bash -c "cd info && npm install"
sudo docker-compose run node bash -c "cd info && npm run build"
2021-04-17 21:38:19 -05:00
else
echo "Please use 'dev', 'build', or 'start' as an argument."
2021-04-17 21:38:19 -05:00
exit 1
2021-04-19 00:42:15 -05:00
fi