chore: clean up build scripts — simple docker build+push to registry.nerdrage.cloud
- Remove build-local.sh and old build-push.sh (crictl/scp/buildah workflow) - New build-push.sh: docker build + push to registry.nerdrage.cloud/dickloads - deployment.yaml: update image to registry.nerdrage.cloud/dickloads:latest, imagePullPolicy Always
This commit is contained in:
@@ -1,37 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# build-push.sh — build humor-units image and import it into containerd on each node
|
||||
# build-push.sh — build and push humor-units image to the private registry
|
||||
# Usage: ./build-push.sh [tag]
|
||||
# Requires: buildah, ssh access to nodes, crictl on nodes
|
||||
# Requires: docker, access to registry.nerdrage.cloud
|
||||
set -euo pipefail
|
||||
|
||||
TAG="${1:-latest}"
|
||||
IMAGE="localhost/humor-units:$TAG"
|
||||
ARCHIVE="/tmp/humor-units.tar"
|
||||
# Space-separated list of node SSH targets
|
||||
NODES="${NODES:-node1 node2}"
|
||||
REGISTRY="registry.nerdrage.cloud"
|
||||
IMAGE="$REGISTRY/dickloads:$TAG"
|
||||
|
||||
echo "==> Building $IMAGE..."
|
||||
buildah build \
|
||||
--format docker \
|
||||
--tag "$IMAGE" \
|
||||
"$(dirname "$0")"
|
||||
docker build --tag "$IMAGE" "$(dirname "$0")"
|
||||
|
||||
echo "==> Exporting to OCI archive $ARCHIVE..."
|
||||
buildah push "$IMAGE" "oci-archive:${ARCHIVE}:${IMAGE}"
|
||||
echo "==> Pushing $IMAGE..."
|
||||
docker push "$IMAGE"
|
||||
|
||||
for NODE in $NODES; do
|
||||
echo "==> Copying to $NODE..."
|
||||
scp "$ARCHIVE" "$NODE:/tmp/humor-units.tar"
|
||||
echo "==> Restarting deployment..."
|
||||
kubectl rollout restart deployment/humor-units -n dickloads
|
||||
|
||||
echo "==> Importing on $NODE via crictl..."
|
||||
ssh "$NODE" "crictl image import /tmp/humor-units.tar && rm /tmp/humor-units.tar"
|
||||
echo "==> Waiting for rollout..."
|
||||
kubectl rollout status deployment/humor-units -n dickloads
|
||||
|
||||
echo "==> Verifying on $NODE..."
|
||||
ssh "$NODE" "crictl images | grep humor"
|
||||
done
|
||||
|
||||
echo "==> Restarting humor-units deployment..."
|
||||
kubectl rollout restart deployment/humor-units -n default
|
||||
|
||||
echo "==> Done. Waiting for rollout..."
|
||||
kubectl rollout status deployment/humor-units -n default
|
||||
echo "==> Done."
|
||||
|
||||
Reference in New Issue
Block a user