-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·79 lines (63 loc) · 1.88 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·79 lines (63 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
# FinKit - Raspberry Pi Deployment
# Usage:
# ./deploy.sh - Pull latest images and restart
# ./deploy.sh pull - Pull images only (no restart)
# ./deploy.sh logs - View logs
# ./deploy.sh status - Show container status
# ./deploy.sh stop - Stop all containers
COMPOSE_FILE="docker-compose.prod.yml"
cd "$(dirname "$0")"
# Colors
G='\033[0;32m' Y='\033[1;33m' R='\033[0;31m' N='\033[0m'
info() { echo -e "${G}$1${N}"; }
warn() { echo -e "${Y}$1${N}"; }
case "${1:-update}" in
pull)
info "📦 Pulling latest images..."
docker compose -f $COMPOSE_FILE pull
info "✅ Done. Run './deploy.sh' to restart with new images."
;;
logs)
docker compose -f $COMPOSE_FILE logs -f
;;
status)
docker compose -f $COMPOSE_FILE ps
;;
stop)
info "🛑 Stopping containers..."
docker compose -f $COMPOSE_FILE down
;;
update|"")
# Check .env
if [ ! -f .env ]; then
if [ -f example.env ]; then
cp example.env .env
warn "Created .env from example. Edit it with your credentials, then run again."
exit 1
fi
fi
# Load env
set -a; source .env 2>/dev/null || true; set +a
# GHCR login if credentials provided
if [ -n "$GITHUB_TOKEN" ] && [ -n "$GITHUB_USER" ]; then
info "🔐 Logging in to ghcr.io..."
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USER" --password-stdin
fi
info "📦 Pulling latest images..."
docker compose -f $COMPOSE_FILE pull
info "🔄 Restarting containers..."
docker compose -f $COMPOSE_FILE up -d --remove-orphans
info "⏳ Waiting for health checks..."
sleep 5
echo ""
docker compose -f $COMPOSE_FILE ps
echo ""
info "✅ Deployed! Access via your Cloudflare tunnel URL."
;;
*)
echo "Usage: ./deploy.sh [pull|logs|status|stop|update]"
exit 1
;;
esac