-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·48 lines (38 loc) · 1.07 KB
/
Copy pathupdate.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.07 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
#!/usr/bin/env bash
set -euo pipefail
APP_DIR="${APP_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
log() {
printf '[update] %s\n' "$*"
}
if docker compose version >/dev/null 2>&1; then
COMPOSE="docker compose"
elif command -v docker-compose >/dev/null 2>&1; then
COMPOSE="docker-compose"
else
log "Docker Compose not found."
exit 1
fi
main() {
cd "${APP_DIR}"
if [[ -d .git ]]; then
log "Pulling latest changes..."
git pull --ff-only
else
log "No git repository found; skipping git pull."
fi
if [[ -f .env ]]; then
set -a
# shellcheck disable=SC1091
source .env
set +a
fi
log "Rebuilding and restarting container..."
${COMPOSE} -f docker-compose.yml up -d --build
if [[ -x "${APP_DIR}/deploy/setup-nginx.sh" ]]; then
APP_DIR="${APP_DIR}" APP_PORT="${APP_PORT:-8080}" PREF_DOMAIN="${PREF_DOMAIN:-pref.tak-solutions.com}" \
CERTBOT_EMAIL="${CERTBOT_EMAIL:-}" bash "${APP_DIR}/deploy/setup-nginx.sh"
fi
log "Update complete."
log "Application URL: http://${PREF_DOMAIN:-pref.tak-solutions.com}/"
}
main "$@"