-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·31 lines (24 loc) · 1014 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·31 lines (24 loc) · 1014 Bytes
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
#!/usr/bin/env bash
#
# Builds Sourcebans Docker images locally
set -euo pipefail
if [ "$#" -ne 1 ] || { [ "$1" != "docker" ] && [ "$1" != "podman" ]; }; then
echo "Usage: $0 <docker|podman>" >&2
exit 1
fi
TOOL="$1"
get_latest_release_tag() {
curl -fsSL \
${GITHUB_TOKEN:+-H "Authorization: Bearer ${GITHUB_TOKEN}"} \
-H "Accept: application/vnd.github+json" \
'https://api.github.com/repos/sbpp/sourcebans-pp/releases?per_page=100' \
| jq -r '[ .[] | select(.prerelease == false) | .tag_name | select(test("^1\\.8\\.[0-9]+$")) ] | first // empty'
}
SB_TAG="$(get_latest_release_tag)"
test -n "$SB_TAG" || { echo "ERROR: could not determine SourceBans release tag" >&2; exit 1; }
EXTRA_ARGS=()
if [ "$TOOL" = "podman" ]; then
# The default OCI image format drops the HEALTHCHECK instruction.
EXTRA_ARGS+=(--format docker)
fi
"$TOOL" build "${EXTRA_ARGS[@]}" -t "crinis/sourcebans:sb-${SB_TAG}" -t crinis/sourcebans:latest --build-arg CHECKOUT="${SB_TAG}" .