services-garbaye/podman-gitea/ci_build-images.sh

29 lines
993 B
Bash
Executable file

#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/gitea-$$
if ! podman image exists ${gitea_image}:${gitea_version}; then
mkdir ${buildfolder} &&
git clone -b v${gitea_version} --depth=1 https://codeberg.org/forgejo/forgejo/ ${buildfolder} && {
TMPDIR=${HOME} podman image build \
--label org.opencontainers.image.version="${gitea_version}" \
-t ${gitea_image}:${gitea_version} -f ${buildfolder}/Dockerfile ${buildfolder}
}
rm -rf ${buildfolder}
podman image prune -a -f --filter dangling=true
podman image prune -a -f --filter intermediate=true
podman image rm -f $(podman images -a -q -- docker.io/library/golang)
podman image rm -f $(podman images -a -q -- docker.io/library/alpine)
else
echo "Image ${gitea_image}:${gitea_version} already built"
fi
oci_push_to_registry ${gitea_image}:${gitea_version}