Rework the container to be non-root, use heredocs for readability, and
use apt-get --no-install-recommends to keep the size down. Rename the
job to x86_32, to be consistent with XEN_TARGET_ARCH and the
naming scheme of all the other CI jobs:
${VERSION}-${ARCH}-${BUILD_NAME}
Remove build dependencies for building QEMU, as we don't do it since
e305256e69b1 ("CI: Stop building QEMU in general").
Remove build dependencies for the documentation as we don't have to
build it for every single arch.
This reduces the size of the container from 2.22GB to 1.32Gb.
Signed-off-by: Javi Merino <javi.merino@cloud.com>
---
automation/build/debian/12-x86_32.dockerfile | 51 +++++++++++++++++++
.../build/debian/bookworm-i386.dockerfile | 50 ------------------
automation/gitlab-ci/build.yaml | 8 +--
automation/scripts/containerize | 2 +-
4 files changed, 56 insertions(+), 55 deletions(-)
create mode 100644 automation/build/debian/12-x86_32.dockerfile
delete mode 100644 automation/build/debian/bookworm-i386.dockerfile
diff --git a/automation/build/debian/12-x86_32.dockerfile b/automation/build/debian/12-x86_32.dockerfile
new file mode 100644
index 000000000000..d3c67a256212
--- /dev/null
+++ b/automation/build/debian/12-x86_32.dockerfile
@@ -0,0 +1,51 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/i386 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+ maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+# build depends
+RUN <<EOF
+#!/bin/bash
+ set -eu
+
+ useradd --create-home user
+
+ apt-get update
+ DEPS=(
+ # Xen
+ bison
+ build-essential
+ checkpolicy
+ clang
+ flex
+
+ # Tools (general)
+ ca-certificates
+ git-core
+ pkg-config
+ wget
+ # libacpi
+ acpica-tools
+ # libxl
+ uuid-dev
+ libyajl-dev
+ # xentop
+ libncurses5-dev
+ # Python bindings
+ python3-dev
+ python3-setuptools
+ # Ocaml bindings/oxenstored
+ ocaml-nox
+ ocaml-findlib
+ )
+ apt-get -y --no-install-recommends install "${DEPS[@]}"
+
+ rm -rf /var/lib/apt/lists*
+EOF
+
+USER user
+WORKDIR /build
+ENTRYPOINT ["linux32"]
diff --git a/automation/build/debian/bookworm-i386.dockerfile b/automation/build/debian/bookworm-i386.dockerfile
deleted file mode 100644
index 66fa3121c54e..000000000000
--- a/automation/build/debian/bookworm-i386.dockerfile
+++ /dev/null
@@ -1,50 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/i386 debian:bookworm
-LABEL maintainer.name="The Xen Project" \
- maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-ENTRYPOINT ["linux32"]
-
-# build depends
-RUN apt-get update && \
- apt-get --quiet --yes install \
- build-essential \
- zlib1g-dev \
- libncurses5-dev \
- python3-dev \
- python3-setuptools \
- uuid-dev \
- libyajl-dev \
- libaio-dev \
- libglib2.0-dev \
- clang \
- libpixman-1-dev \
- pkg-config \
- flex \
- bison \
- acpica-tools \
- bin86 \
- bcc \
- liblzma-dev \
- libc6-dev \
- libnl-3-dev \
- ocaml-nox \
- libfindlib-ocaml-dev \
- markdown \
- transfig \
- pandoc \
- checkpolicy \
- wget \
- git \
- nasm \
- apt-transport-https \
- && \
- apt-get autoremove -y && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index eb2c23619a2c..1b322044ab19 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -569,15 +569,15 @@ debian-12-x86_64-gcc-randconfig:
CONTAINER: debian:12-x86_64
RANDCONFIG: y
-debian-bookworm-32-clang-debug:
+debian-12-x86_32-clang-debug:
extends: .clang-x86-32-build-debug
variables:
- CONTAINER: debian:bookworm-i386
+ CONTAINER: debian:12-x86_32
-debian-bookworm-32-gcc-debug:
+debian-12-x86_32-gcc-debug:
extends: .gcc-x86-32-build-debug
variables:
- CONTAINER: debian:bookworm-i386
+ CONTAINER: debian:12-x86_32
fedora-40-x86_64-gcc:
extends: .gcc-x86-64-build
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index ea6e1a9b18f4..d72c22c103ff 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -35,7 +35,7 @@ case "_${CONTAINER}" in
_bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
_bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
_bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
- _bookworm-i386) CONTAINER="${BASE}/debian:bookworm-i386" ;;
+ _bookworm-i386|_bookworm-x86_32) CONTAINER="${BASE}/debian:12-x86_32" ;;
_bookworm-arm64v8-arm32-gcc) CONTAINER="${BASE}/debian:bookworm-arm64v8-arm32-gcc" ;;
_bookworm-arm64v8) CONTAINER="${BASE}/debian:bookworm-arm64v8" ;;
_bookworm-cppcheck) CONTAINER="${BASE}/debian:bookworm-cppcheck" ;;
--
2.45.2
On Thu, Oct 24, 2024 at 11:04:17AM +0100, Javi Merino wrote: > Rework the container to be non-root, use heredocs for readability, and > use apt-get --no-install-recommends to keep the size down. Rename the > job to x86_32, to be consistent with XEN_TARGET_ARCH and the > naming scheme of all the other CI jobs: > ${VERSION}-${ARCH}-${BUILD_NAME} > > Remove build dependencies for building QEMU, as we don't do it since > e305256e69b1 ("CI: Stop building QEMU in general"). > > Remove build dependencies for the documentation as we don't have to > build it for every single arch. > > This reduces the size of the container from 2.22GB to 1.32Gb. > > Signed-off-by: Javi Merino <javi.merino@cloud.com> > --- > automation/build/debian/12-x86_32.dockerfile | 51 +++++++++++++++++++ > .../build/debian/bookworm-i386.dockerfile | 50 ------------------ > automation/gitlab-ci/build.yaml | 8 +-- > automation/scripts/containerize | 2 +- > 4 files changed, 56 insertions(+), 55 deletions(-) > create mode 100644 automation/build/debian/12-x86_32.dockerfile > delete mode 100644 automation/build/debian/bookworm-i386.dockerfile > > diff --git a/automation/build/debian/12-x86_32.dockerfile b/automation/build/debian/12-x86_32.dockerfile > new file mode 100644 > index 000000000000..d3c67a256212 > --- /dev/null > +++ b/automation/build/debian/12-x86_32.dockerfile > @@ -0,0 +1,51 @@ > +# syntax=docker/dockerfile:1 > +FROM --platform=linux/i386 debian:bookworm > +LABEL maintainer.name="The Xen Project" \ > + maintainer.email="xen-devel@lists.xenproject.org" > + > +ENV DEBIAN_FRONTEND=noninteractive > +ENV USER root This line shouldn't be here. I forgot to remove it. The container has a USER line at the end to set it. Cheers, Javi
© 2016 - 2024 Red Hat, Inc.