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

29 lines
1.1 KiB
Bash
Raw Normal View History

2022-05-26 19:00:27 +00:00
#!/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} &&
2023-02-25 17:49:38 +00:00
curl -sSfL -- "https://codeberg.org/forgejo/forgejo/archive/v${gitea_version}.tar.gz" | tar xz --strip-components=1 -C ${buildfolder}/ && {
sed_in_place "^FROM golang" "FROM docker.io/library/golang" ${buildfolder}/Dockerfile
sed_in_place "^FROM alpine" "FROM docker.io/library/alpine" ${buildfolder}/Dockerfile
TMPDIR=${HOME} podman image build -t ${gitea_image}:${gitea_version} -f ${buildfolder}/Dockerfile ${buildfolder}
}
2022-05-26 19:00:27 +00:00
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"
2022-05-26 19:00:27 +00:00
fi
oci_push_to_registry ${gitea_image}:${gitea_version}