-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·52 lines (43 loc) · 1.33 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.33 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
#!/usr/bin/env bash
set -euo pipefail
# ─── helper: git 태그 기반 버전 계산 ─────────────────────────────────
function get_tag() {
GIT_DESCRIBE="$(git describe --tags --long --match "v[0-9]*" 2>/dev/null || echo "")"
if [[ -z "$GIT_DESCRIBE" ]]; then
echo "not-released"
return
fi
if [[ "$GIT_DESCRIBE" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)-g[0-9a-f]+$ ]]; then
BASE="${BASH_REMATCH[1]}"
CNT="${BASH_REMATCH[2]}"
MAJMIN=$(echo "$BASE" | sed -E 's/^([0-9]+\.[0-9]+)\..*$/\1/')
TAG="v${MAJMIN}.${CNT}"
elif [[ "$GIT_DESCRIBE" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
BASE="${BASH_REMATCH[1]}"
MAJMIN=$(echo "$BASE" | sed -E 's/^([0-9]+\.[0-9]+)\..*$/\1/')
TAG="v${MAJMIN}.0"
else
echo "not-released"
return
fi
local mode="${1:-}"
if [[ "$mode" = "test" ]]; then
TAG="${TAG}-st"
fi
echo "$TAG"
}
REGISTRY="linky1584/koina"
TAG=$(get_tag)
IMAGE="${REGISTRY}:${TAG}"
echo "→ Building Docker image ${IMAGE}"
docker buildx build \
--platform linux/amd64 \
--build-arg MF_ARCH=x86_64 \
-t "${IMAGE}" \
. --load
echo "→ Pushing ${IMAGE} to Docker Hub"
docker push "${IMAGE}"
echo "→ Tagging latest"
docker tag "${IMAGE}" "${REGISTRY}:latest"
docker push "${REGISTRY}:latest"
echo "Deployed ${IMAGE}"