Files
recipe-app/deploy.sh
T

42 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# deploy.sh Bygg och starta om recipe-app
# Kör från: /opt/containers/recipe-app/
# Kräver: .env-fil i samma mapp
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
if [ ! -f ".env" ]; then
echo "Fel: .env saknas. Kopiera .env.example och fyll i värdena:"
echo " cp .env.example .env && nano .env"
exit 1
fi
echo "Bygger images..."
docker compose -f compose.yml -f compose.flutter.yml build
echo "Startar tjänster..."
docker compose -f compose.yml -f compose.flutter.yml up -d
echo "Kör kategori-seed..."
MARIADB_ROOT_PASSWORD=$(grep MARIADB_ROOT_PASSWORD .env | cut -d '=' -f2 | tr -d '"' | tr -d "'")
MARIADB_DATABASE=$(grep MARIADB_DATABASE .env | cut -d '=' -f2 | tr -d '"' | tr -d "'")
echo "Väntar på att databasen är redo..."
for i in $(seq 1 30); do
if docker exec recipe-db mariadb-admin ping -h 127.0.0.1 -uroot -p"$MARIADB_ROOT_PASSWORD" --silent 2>/dev/null; then
break
fi
echo " ...försök $i/30"
sleep 2
done
docker exec -i recipe-db mariadb -uroot -p"$MARIADB_ROOT_PASSWORD" "$MARIADB_DATABASE" \
< db/seeds/categories_supplement.sql
echo "Kategori-seed klar."
echo "Status:"
docker compose ps