From 171f1fc0151445469d5ecd9fc1c3c28c2bb76d54 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 6 Nov 2024 15:10:39 +0100 Subject: [PATCH 1/2] Add ccache and CPM cache in ubuntu22 image builds --- docker/Dockerfile.base.ubuntu22 | 1 + docker/Dockerfile.build.ubuntu22 | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.base.ubuntu22 b/docker/Dockerfile.base.ubuntu22 index 60e2aad8ab..5bddb3f88f 100644 --- a/docker/Dockerfile.base.ubuntu22 +++ b/docker/Dockerfile.base.ubuntu22 @@ -40,6 +40,7 @@ RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \ #gcc needed for build_oai build-essential \ + ccache \ psmisc \ git \ #use gcc-12 to avoid problems of default gcc-11 in FlexRIC diff --git a/docker/Dockerfile.build.ubuntu22 b/docker/Dockerfile.build.ubuntu22 index c0de631c41..2f394e247b 100644 --- a/docker/Dockerfile.build.ubuntu22 +++ b/docker/Dockerfile.build.ubuntu22 @@ -36,7 +36,12 @@ WORKDIR /oai-ran COPY . . # build all targets so final targets can be created afterwards -RUN /bin/sh oaienv && \ +RUN \ + # Mount CCache cache direrctory + --mount=type=cache,target=/root/.cache/ccache/ \ + # Mount CPM package cache + --mount=type=cache,target=/root/.cache/cpm/ \ + /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ ./build_oai -c --ninja \ @@ -54,7 +59,10 @@ RUN /bin/sh oaienv && \ ldd ran_build/build/*.so ## Build FlexRIC for SM Models -RUN mkdir -p openair2/E2AP/flexric/build && \ +RUN \ + # Mount CCache cache direrctory + --mount=type=cache,target=/root/.cache/ccache/ \ + mkdir -p openair2/E2AP/flexric/build && \ cd openair2/E2AP/flexric/build && \ cmake -GNinja -DCMAKE_BUILD_TYPE=Release \ -DXAPP_MULTILANGUAGE=OFF \ From 8be33ed66f8760e9d051d02f26f51c464c8f9a60 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 29 May 2025 15:10:23 +0200 Subject: [PATCH 2/2] Make ubuntu22 base image docker cache friendly Use wget instead of ADD to allow efficient caching of tini install. --- docker/Dockerfile.base.ubuntu22 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.base.ubuntu22 b/docker/Dockerfile.base.ubuntu22 index 5bddb3f88f..ba8707d4db 100644 --- a/docker/Dockerfile.base.ubuntu22 +++ b/docker/Dockerfile.base.ubuntu22 @@ -53,15 +53,15 @@ RUN apt-get update && \ flex \ m4 \ # python3-pip for conf template generation - python3-pip && \ + python3-pip \ + wget && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 && \ pip3 install --ignore-installed pyyaml # Add "Tini - A tiny but valid init for containers", https://github.com/krallin/tini # it will be copied into target containers, to print exit numbers and handle signals properly ENV TINI_VERSION=v0.19.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN chmod +x /tini +RUN wget https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} -O /tini && chmod +x /tini # In some network environments, GIT proxy is required RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"