Replace build-and-tag.sh with uniform build script; set version.txt to v8
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CfGMAJK5sD43otMxjBYEy
This commit is contained in:
1 parent
2cbb4a4d1f
commit
e17d57e88e
3 files changed
+17
-29
No files matched your search
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the next versioned image, push it (+ :latest) to the registry, and
|
||||
# record the new version in version.txt. Usage: ./build
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
|
||||
|
||||
IMAGE=registry.digitalsorcery.net/hardings-service
|
||||
NEXT="v$(($(tr -d 'v[:space:]' < version.txt) + 1))"
|
||||
|
||||
podman build --pull=always -t "$IMAGE:$NEXT" -t "$IMAGE:latest" .
|
||||
podman push "$IMAGE:$NEXT"
|
||||
podman push "$IMAGE:latest"
|
||||
echo "$NEXT" > version.txt
|
||||
|
||||
echo "Pushed $IMAGE:$NEXT"
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the container image and tag it for the registry.
|
||||
# Usage: ./build-and-tag.sh # reads version.txt, increments, builds, pushes
|
||||
# Usage: ./build-and-tag.sh <tag> # explicit tag (e.g. ./build-and-tag.sh v6)
|
||||
set -e
|
||||
|
||||
IMAGE=hardings-service
|
||||
REGISTRY=registry.digitalsorcery.net
|
||||
VERSION_FILE="$(dirname "$0")/version.txt"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
TAG="$1"
|
||||
else
|
||||
# Read current version, increment the numeric portion
|
||||
CURRENT=$(cat "$VERSION_FILE" | tr -d '[:space:]')
|
||||
NUM=$(echo "$CURRENT" | sed 's/v//')
|
||||
TAG="v$((NUM + 1))"
|
||||
fi
|
||||
|
||||
echo "Building ${IMAGE}:${TAG} ..."
|
||||
podman build -t "${IMAGE}:${TAG}" -f Containerfile .
|
||||
podman tag "${IMAGE}:${TAG}" "${REGISTRY}/${IMAGE}:${TAG}"
|
||||
podman push "${REGISTRY}/${IMAGE}:${TAG}"
|
||||
|
||||
# Update version.txt to match the tag we just pushed
|
||||
echo "$TAG" > "$VERSION_FILE"
|
||||
|
||||
echo "Done. ${REGISTRY}/${IMAGE}:${TAG} pushed."
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v7
|
||||
v8
|
||||
Reference in new issue
Block a user