forked from Kpa-clawbot/CoreScope
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-live.sh
More file actions
40 lines (32 loc) · 1.25 KB
/
Copy pathdeploy-live.sh
File metadata and controls
40 lines (32 loc) · 1.25 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
#!/bin/bash
set -e
DEPLOY_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DEPLOY_DIR"
echo "[deploy] Fetching latest from origin..."
git fetch --tags origin
echo "[deploy] Resetting to origin/master..."
git reset --hard origin/master
GIT_COMMIT=$(git rev-parse --short HEAD)
APP_VERSION=$(git tag --points-at HEAD | grep -E '^v[0-9]' | sort -V | tail -1)
APP_VERSION=${APP_VERSION:-$(git describe --tags --abbrev=0 2>/dev/null || echo dev)}
BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
echo "[deploy] Version: ${APP_VERSION} commit: ${GIT_COMMIT}"
echo "[deploy] Building Docker image (linux/arm64)..."
docker build \
--build-arg BUILDPLATFORM=linux/arm64 \
--build-arg TARGETOS=linux \
--build-arg TARGETARCH=arm64 \
--build-arg APP_VERSION="${APP_VERSION}" \
--build-arg GIT_COMMIT="${GIT_COMMIT}" \
--build-arg BUILD_TIME="${BUILD_TIME}" \
-t meshcore-analyzer .
echo "[deploy] Stopping old container (30s grace period)..."
docker stop -t 30 meshcore-analyzer && docker rm meshcore-analyzer
docker run -d --name meshcore-analyzer \
--restart unless-stopped \
--network mesh-internal \
-p 3000:3000 \
-v "$(pwd)/config.json:/app/config.json:ro" \
-v meshcore-data:/app/data \
meshcore-analyzer
echo "[deploy] Done. Live at https://analyzer.on8ar.eu"