Switched CI image building to Dockerfile while still using buildah.

This commit is contained in:
Heiko Reese
2021-10-07 23:49:46 +02:00
parent ea589221b4
commit 05ef7c4467
2 changed files with 51 additions and 32 deletions

29
ci_container/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM debian:latest
RUN apt-get update; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \
build-essential \
exim4-daemon-heavy \
exim4-dev \
gcovr \
git \
libsodium-dev \
openssl \
pkg-config \
python3-pip \
libxml2-utils; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \
debhelper \
debsigs \
devscripts \
dh-make \
git-buildpackage \
gpgv1 \
meson; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \
vim; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get clean; \
rm -rf /var/lib/apt/lists/*;
RUN pip3 install --upgrade meson ninja; \
rm -rf ~/.cache/pip/*;

View File

@ -29,7 +29,15 @@ while getopts "r:u:p:b:t:" OPTION; do
TAG="${OPTARG}" TAG="${OPTARG}"
;; ;;
*) *)
echo "Invalid argument" echo "Usage: $0 [OPTIONS]"
echo
echo "Options:"
echo " -r <registry> (default: \"${REGISTRY}\")"
echo " -u <username> (default: \"${USERNAME}\")"
echo " -p <password> (default: \"${PASSWORD}\")"
echo " -b <basename> (default: \"${BASENAME}\")"
echo " -t <tag> (default: \"${TAG}\")"
echo
exit 127 exit 127
esac esac
done done
@ -47,39 +55,21 @@ for i in "${images[@]}"; do
name=$(echo "${i}" | cut -d'|' -f2) name=$(echo "${i}" | cut -d'|' -f2)
IMAGENAME="${BASENAME}-${name}" IMAGENAME="${BASENAME}-${name}"
IIDFILE=".${IMAGENAME}.iid"
IMAGETAG="${BASENAME}-${name}:${TAG}"
TARGET="${REGISTRY}/${IMAGETAG}"
echo "🔨 Assembling »${IMAGENAME}«" echo "🔨 Assembling »${IMAGENAME}«"
ctr="$(buildah from "$basectr")" buildah build-using-dockerfile \
buildah run "$ctr" /bin/sh -c 'apt-get update; \ --from "${basectr}" \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \ --format docker \
build-essential \ --iidfile "${IIDFILE}" \
exim4-daemon-heavy \ --tag "${IMAGETAG}"
exim4-dev \
gcovr \
git \
libsodium-dev \
openssl \
pkg-config \
python3-pip \
libxml2-utils; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \
debhelper \
debsigs \
devscripts \
dh-make \
git-buildpackage \
gpgv1 \
meson; \
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install --no-install-recommends -y \
vim; \
rm -rf /var/lib/apt/lists/*;'
buildah run "$ctr" /bin/sh -c \
'pip3 install --upgrade meson ninja; \
rm -rf ~/.cache/pip/*;'
TARGET="${REGISTRY}/${BASENAME}-${name}:${TAG}"
IMAGEID=$(buildah commit --format docker "$ctr" "${IMAGENAME}")
if [ "${REGISTRY}" != "none" ]; then if [ "${REGISTRY}" != "none" ]; then
echo "🚀 Pushing »${TARGET}«" echo "🚀 Pushing »${IMAGETAG}« to »${TARGET}«"
buildah push "${IMAGEID}" "${TARGET}" buildah push "${IMAGETAG}" "${TARGET}"
echo "✅ Finished »${BASENAME}«" echo "✅ Finished »${BASENAME}«"
fi fi
rm -f "${IIDFILE}"
done done