CI: Add a debian-stable-i386 CI image

This is identical to the debian-stable image, except that it uses
packages from the i386 dpkg architecture (i686-linux-gnu) instead of
amd64 (x86_64-linux-gnu). x86_64 Docker hosts with x86_64 kernels can
run i386 Docker images, so we can use our existing CI workers.

Instead of duplicating the content of the Dockerfile, add a layer of
architecture-switching so we can build essentially the same image
from a different base.

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2024-10-18 12:10:46 +01:00
parent f8ecf25975
commit 630930a60b
2 changed files with 27 additions and 4 deletions

View File

@ -1,4 +1,5 @@
FROM debian:bookworm
ARG ARCHITECTURE_PREFIX=
FROM ${ARCHITECTURE_PREFIX}debian:bookworm
RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
bindfs \

View File

@ -85,6 +85,8 @@ if [ $list == 1 ]; then
echo -e " \\e[1;39m$basename\\e[0m"
done
# Special cases that don't have their own Dockerfile
echo -e " \\e[1;39mdebian-stable-i386\\e[0m"
exit 0
fi
@ -94,8 +96,25 @@ if [ -z "${base}" ]; then
exit 1
fi
if [ ! -f "$base.Dockerfile" ]; then
echo -e "\\e[1;31mERROR\\e[0m: Dockerfile for '$base' not found"
case "$base" in
(debian-stable-i386)
dockerfile=debian-stable
arch=386
if [ "$DOCKER_CMD" = "podman" ]; then
arch_prefix=docker.io/i386/
else
arch_prefix=i386/
fi
;;
(*)
dockerfile="$base"
arch=""
arch_prefix=""
;;
esac
if [ ! -f "$dockerfile.Dockerfile" ]; then
echo -e "\\e[1;31mERROR\\e[0m: Dockerfile for '$dockerfile' not found"
exit 1
fi
@ -113,8 +132,10 @@ if [ $build == 1 ]; then
--build-arg HOST_USER_ID="$UID" \
--build-arg COVERITY_SCAN_PROJECT_NAME="${COVERITY_SCAN_PROJECT_NAME}" \
--build-arg COVERITY_SCAN_TOKEN="${COVERITY_SCAN_TOKEN}" \
${arch_prefix+--build-arg ARCHITECTURE_PREFIX="${arch_prefix}"} \
${arch+--arch="$arch"} \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
--file "${dockerfile}.Dockerfile" .
exit $?
fi
@ -132,6 +153,7 @@ fi
if [ $run == 1 ]; then
echo -e "\\e[1;32mRUNNING\\e[0m: ${base} as ${TAG}"
$DOCKER_CMD run \
${arch+--arch="$arch"} \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--workdir "/home/user/app" \