fix: build-push.sh — push via port-forward, tag with in-cluster registry address

This commit is contained in:
Falkan
2026-03-19 01:08:02 -04:00
parent 177b15920f
commit e5ff5a90c5

View File

@@ -5,10 +5,11 @@
set -euo pipefail set -euo pipefail
TAG="${1:-latest}" TAG="${1:-latest}"
REGISTRY="localhost:5000" # via kubectl port-forward # In-cluster address — how the deployment manifest references the image
REGISTRY="registry.registry.svc.cluster.local:5000"
IMAGE="$REGISTRY/humor-units:$TAG" IMAGE="$REGISTRY/humor-units:$TAG"
echo "==> Port-forwarding registry..." echo "==> Port-forwarding registry (localhost:5000 -> in-cluster registry)..."
kubectl port-forward -n registry svc/registry 5000:5000 & kubectl port-forward -n registry svc/registry 5000:5000 &
PF_PID=$! PF_PID=$!
trap "kill $PF_PID 2>/dev/null" EXIT trap "kill $PF_PID 2>/dev/null" EXIT
@@ -20,8 +21,13 @@ buildah build \
--tag "$IMAGE" \ --tag "$IMAGE" \
"$(dirname "$0")" "$(dirname "$0")"
echo "==> Pushing $IMAGE..." echo "==> Pushing via port-forward (localhost:5000)..."
buildah push --tls-verify=false "$IMAGE" # Push to localhost:5000 (the port-forward tunnel) but with the in-cluster tag.
# buildah push accepts a separate destination so we don't retag.
buildah push \
--tls-verify=false \
"$IMAGE" \
"docker://localhost:5000/humor-units:$TAG"
echo "==> Restarting humor-units deployment..." echo "==> Restarting humor-units deployment..."
kubectl rollout restart deployment/humor-units -n default kubectl rollout restart deployment/humor-units -n default