ai-cost-tracker/infra/deploy/update.sh

25 lines
652 B
Bash
Executable file

#!/usr/bin/env bash
# Run directly on the server from /opt/ai-cost-tracker/
# Usage: ./infra/deploy/update.sh [--no-cache]
# Updates to latest code and restarts all containers
set -euo pipefail
COMPOSE="docker compose -f infra/docker-compose.yml"
NO_CACHE=${1:-}
echo "==> Pulling latest code..."
git pull origin main
echo "==> Building containers${NO_CACHE:+ (no-cache)}..."
$COMPOSE build ${NO_CACHE:+--no-cache}
echo "==> Restarting services..."
$COMPOSE up -d
echo "==> Status:"
$COMPOSE ps
echo ""
echo "Done! App: https://optical-dev.oliver.solutions/cost-tracker/"
echo "API: https://optical-dev.oliver.solutions/cost-tracker/v1/health"