2022-05-26 19:00:27 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
2023-07-29 07:14:59 +00:00
|
|
|
source "${ABSDIR}"/../functions.sh
|
|
|
|
source "${ABSDIR}"/vars.sh
|
2022-05-26 19:00:27 +00:00
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
|
|
|
buildfolder=/tmp/gitea-$$
|
|
|
|
|
|
|
|
if ! podman image exists ${gitea_image}:${gitea_version}; then
|
|
|
|
mkdir ${buildfolder} &&
|
2023-07-29 07:14:59 +00:00
|
|
|
if git clone -b v${gitea_version} --depth=1 https://codeberg.org/forgejo/forgejo/ ${buildfolder} ; then
|
2023-07-28 21:08:44 +00:00
|
|
|
TMPDIR=${HOME} podman image build \
|
|
|
|
--label org.opencontainers.image.version="${gitea_version}" \
|
|
|
|
-t ${gitea_image}:${gitea_version} \
|
2023-10-28 15:41:15 +00:00
|
|
|
-f ${buildfolder}/Dockerfile \
|
|
|
|
${buildfolder} || retval=false
|
2023-07-28 21:08:44 +00:00
|
|
|
podman image prune -a -f --filter dangling=true
|
|
|
|
podman image prune -a -f --filter intermediate=true
|
2023-10-28 15:16:30 +00:00
|
|
|
podman image rm -f $(podman image list -a -q -- docker.io/library/golang)
|
|
|
|
podman image rm -f $(podman image list -a -q -- docker.io/library/alpine)
|
2024-05-17 22:00:43 +00:00
|
|
|
podman image rm -f $(podman image list -a -q -- docker.io/tonistiigi/xx)
|
2023-07-29 07:14:59 +00:00
|
|
|
fi
|
2022-05-26 19:00:27 +00:00
|
|
|
rm -rf ${buildfolder}
|
2023-07-29 07:14:59 +00:00
|
|
|
eval "$retval"
|
2022-08-13 21:14:13 +00:00
|
|
|
else
|
|
|
|
echo "Image ${gitea_image}:${gitea_version} already built"
|
2023-07-28 21:08:44 +00:00
|
|
|
fi &&
|
2022-08-13 21:14:13 +00:00
|
|
|
|
|
|
|
oci_push_to_registry ${gitea_image}:${gitea_version}
|