ci(deploy): standardize docker compose env file usage across scripts
- Added --env-file .env to all docker compose commands for consistent environment variable loading - Added MISTRAL_API_KEY validation in deploy.sh with fatal error if missing - Added --force-recreate flag to recipe-api restarts in disable/enable receipt trace scripts - Added .env file existence check in rebuild_flutter.sh - Added API service recreation logic in deploy.sh when backend/importer services are updated
This commit is contained in:
@@ -143,7 +143,10 @@ if [ "$BUILD_BACKEND" = true ] || [ "$RUN_SEED" = true ] || [ "$RUN_CLEAN_DATABA
|
||||
fi
|
||||
|
||||
export SKIP_MIGRATION
|
||||
COMPOSE_CMD=(docker compose -f compose.yml -f compose.flutter.yml)
|
||||
COMPOSE_CMD=(docker compose --env-file .env -f compose.yml -f compose.flutter.yml)
|
||||
|
||||
MISTRAL_API_KEY="$(read_env_value MISTRAL_API_KEY)"
|
||||
[ -n "$MISTRAL_API_KEY" ] || fatal "MISTRAL_API_KEY saknas i .env"
|
||||
|
||||
# ── Git pull ──────────────────────────────────────────────────────────────────
|
||||
info "Hämtar senaste kod (recipe-app)..."
|
||||
@@ -178,6 +181,11 @@ fi
|
||||
info "Startar tjänster..."
|
||||
"${COMPOSE_CMD[@]}" up -d
|
||||
|
||||
if [ "$BUILD_BACKEND" = true ] || [ "$BUILD_IMPORTER" = true ]; then
|
||||
info "Återskapar API-tjänster för att säkra uppdaterade env-variabler..."
|
||||
"${COMPOSE_CMD[@]}" up -d --force-recreate recipe-api importer-api
|
||||
fi
|
||||
|
||||
# ── Databasrensning (opt-in) ──────────────────────────────────────────────────
|
||||
if [ "$RUN_CLEAN_DATABASE" = true ]; then
|
||||
CLEAN_SQL_FILE="backend/prisma/maintenance/clean-database.sql"
|
||||
|
||||
Reference in New Issue
Block a user