25 lines
1,006 B
Bash
25 lines
1,006 B
Bash
|
#!/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} &&
|
||
|
curl -sSfL -- "https://dl.gitea.io/gitea/${gitea_version}/gitea-src-${gitea_version}.tar.gz" | tar xz -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}
|
||
|
}
|
||
|
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)
|
||
|
fi
|