criu/scripts/build/Dockerfile.stable-cross.tmpl
Radostin Stoyanov a72bf212ec scripts: improve layer caching of container builds
The scripts installing dependencies are now copied and executed before
copying the full source tree. This allows to cache the dependency
installation layers as long as these scripts remain unchanged.
Previously, copying the entire repository invalidated the cache on every
source change. While our CI intentionally doesn't preserve cached layers
across independent runs, the changes in this patch help with local testing
when investigating issues.

Examples:
 - sudo -E make -C scripts/ci alpine GCC=1
 - sudo -E make -C scripts/ci alpine CLANG=1

Suggested-by: Andrei Vagin <avagin@google.com>
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2026-03-09 08:33:03 -07:00

31 lines
1 KiB
Cheetah

# Add the cross compiler sources
RUN echo "deb http://deb.debian.org/debian/ stable main" >> /etc/apt/sources.list && \
dpkg --add-architecture ${DEBIAN_ARCH}
ENV CROSS_COMPILE=${CROSS_TRIPLET}- \
CROSS_ROOT=/usr/${CROSS_TRIPLET} \
AS=/usr/bin/${CROSS_TRIPLET}-as \
AR=/usr/bin/${CROSS_TRIPLET}-ar \
CC=/usr/bin/${CROSS_TRIPLET}-gcc \
CPP=/usr/bin/${CROSS_TRIPLET}-cpp \
CXX=/usr/bin/${CROSS_TRIPLET}-g++ \
LD=/usr/bin/${CROSS_TRIPLET}-ld \
FC=/usr/bin/${CROSS_TRIPLET}-gfortran
ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig
COPY contrib/dependencies/apt-cross-packages.sh /criu/contrib/dependencies/apt-cross-packages.sh
COPY contrib/apt-install /criu/contrib/apt-install
WORKDIR /criu
RUN /criu/contrib/dependencies/apt-cross-packages.sh
COPY . /criu
# amdgpu_plugin with armv7 is not supported
RUN make mrproper && date && \
make -j $(nproc) && \
if [ "$SUBARCH" != "armv7" ]; then \
make -j $(nproc) amdgpu_plugin; \
fi && \
make -j $(nproc) zdtm && date