odi6/podman_push.sh

26 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2025-07-19 12:09:17 +02:00
#!/bin/bash
2025-07-19 12:10:26 +02:00
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
repo="$(basename "${script_dir}")"
2025-07-19 12:09:17 +02:00
tag="${1}"
if [ -z "${tag}" ]; then
2025-07-19 12:14:17 +02:00
git_tag=$(git describe --exact-match --tags)
if [ "${git_tag}" == 'master' ] || [ "${git_tag}" == 'main' ] || [ -z "${git_tag}" ]; then
2025-07-19 12:09:17 +02:00
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
2025-07-19 12:14:17 +02:00
tag="${git_tag}"
2025-07-19 12:09:17 +02:00
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}"
2025-07-19 12:42:23 +02:00
tag=latest
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}"