diff --git a/.github/workflows/rtpproxy_ci.yml b/.github/workflows/rtpproxy_ci.yml index 9b4e875c8..d69b3b561 100644 --- a/.github/workflows/rtpproxy_ci.yml +++ b/.github/workflows/rtpproxy_ci.yml @@ -408,6 +408,7 @@ jobs: LOCAL_REPO: localhost:5000/sippylabs/rtpproxy PLATFORMS: linux/amd64 #,linux/i386,linux/arm/v7,linux/arm64 BASE_IMAGE: debian:12-slim + CCACHE_ROOT: /tmp/ccache steps: - name: Checkout repository uses: actions/checkout@v4 @@ -449,7 +450,7 @@ jobs: - name: Cache the compiler cache uses: actions/cache@v4 with: - path: ccache + path: ${{ env.CCACHE_ROOT }} key: dockerhub-ccache-${{ github.run_id }} restore-keys: | dockerhub-ccache @@ -464,10 +465,11 @@ jobs: with: context: . file: ./docker/Dockerfile - build-args: BASE_IMAGE=${{ env.BASE_IMAGE }} + build-args: | + BASE_IMAGE=${{ env.BASE_IMAGE }} + CCACHE_ROOT=${{ env.CCACHE_ROOT }} tags: ${{ env.LOCAL_REPO }}:latest platforms: ${{ env.PLATFORMS }} - outputs: type=tar,dest=/tmp/ccache_export.tar push: true cache-from: ${{ env.CACHE_SPEC }} cache-to: ${{ env.CACHE_SPEC }},mode=max @@ -492,6 +494,4 @@ jobs: - name: Extract ccaches run: | - rm -rf ccache - tar --strip-components=2 --no-wildcards-match-slash --wildcards -x -f /tmp/ccache_export.tar "*/rtpproxy/ccache" - du -d1 -h ccache + du -d1 -h ${{ env.CCACHE_ROOT }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 077c6d127..13cc57528 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,6 +20,10 @@ COPY docker/install_depends.sh /tmp RUN ./install_depends.sh COPY --exclude=.git* --link . /rtpproxy/ + +ARG CCACHE_ROOT +RUN --mount=type=cache,target=${CCACHE_ROOT} + WORKDIR /rtpproxy RUN /rtpproxy/docker/build.sh diff --git a/docker/build.sh b/docker/build.sh index 8619473a5..8e94127d3 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -16,7 +16,7 @@ fi cd "${RTPDIR}" -CCACHE_ROOT="${RTPDIR}/ccache" +CCACHE_ROOT="${CCACHE_ROOT:-"${RTPDIR}/ccache"}" export PATH="/usr/lib/ccache:${PATH}" export CCACHE_DIR="${CCACHE_ROOT}/${ARCH}" if [ ! -e "${CCACHE_DIR}" ]