-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·48 lines (35 loc) · 1.04 KB
/
update.sh
File metadata and controls
executable file
·48 lines (35 loc) · 1.04 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
#!/bin/bash
set -e
source .env
echo "[i] Updating your moonlight instance"
echo "[i] Checking for updates on deploy repo"
# Fetch remote updates
git fetch
# Get current branch name
branch=$(git rev-parse --abbrev-ref HEAD)
# Compare local and remote branch
local_commit=$(git rev-parse "$branch")
remote_commit=$(git rev-parse "origin/$branch")
if [ "$local_commit" != "$remote_commit" ]; then
echo "[i] The deploy repository has updates. Fetching changes"
git pull
echo "[i] Updated deploy tools. Please rerun the update.sh"
exit 0
else
echo "[i] No update of the deploy repository available"
fi
if [ "$MOONLIGHT_PULL_POLICY" == "build" ]; then
echo "[i] Rebuilding the docker image"
docker compose build
echo "[i] Rebuild done"
fi
if [ "$MOONLIGHT_PULL_POLICY" == "always" ]; then
echo "[i] Pulling the latest docker image"
docker compose pull
echo "[i] Pulling completed"
fi
echo "[i] Stopping containers"
docker compose down
echo "[i] Starting containers"
docker compose up -d
echo "[i] Update done :>"