From 9bad824eaf7a5875d309cbc9bd9544833c41c290 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Sat, 19 Jul 2025 13:09:17 +0300 Subject: [PATCH] add podman push --- podman_push.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 podman_push.sh diff --git a/podman_push.sh b/podman_push.sh new file mode 100644 index 0000000..d48caf9 --- /dev/null +++ b/podman_push.sh @@ -0,0 +1,17 @@ +#!/bin/bash +repo="$(basename "$(pwd)")" +tag="${1}" +if [ -z "${tag}" ]; then + git_reference=$(grep '^ref: ' .git/HEAD | awk 'BEGIN {FS="/"} {print($NF)}') + if [ "${git_reference}" == 'master' ] || [ "${git_reference}" == 'main' ] || [ -z "${git_reference}" ]; then + echo "Change to a different git reference not 'master/main', since it will be used as tag for the container. Or pass a tag name as only parameter." + exit 1 + fi + tag="${git_reference}" +fi +echo "Building '${repo}:${tag}'..." +podman build --tag "${repo}:${tag}" . +echo "Tagging it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..." +podman tag "${repo}:${tag}" "repos.susurrando.com/adelgado/${repo}:${tag}" +echo "Pushing it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..." +podman push "repos.susurrando.com/adelgado/${repo}:${tag}"