Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Jul 24, 2024
1 parent fe1f38b commit beedd78
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/rtpproxy_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,9 @@ jobs:
env:
DOCKER_REPO: sippylabs/rtpproxy
LOCAL_REPO: localhost:5000/sippylabs/rtpproxy
PLATFORMS: linux/amd64 #,linux/i386,linux/arm/v7,linux/arm64
PLATFORMS: linux/amd64,linux/i386,linux/arm/v7,linux/arm64
BASE_IMAGE: debian:12-slim
CCACHE_ROOT: ccache
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -449,13 +450,14 @@ 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
- name: Get branch name
run: echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
run: |
echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
- name: Build Docker image
uses: docker/build-push-action@v6
Expand All @@ -464,10 +466,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
Expand All @@ -490,8 +493,16 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: sh -x docker/update_description.sh docker/README.md

- name: Save Docker image
uses: docker/build-push-action@v6
with:
file: ./docker/Dockerfile.export_ccache
build-args: BASE_IMAGE=${{ env.LOCAL_REPO }}:latest
platforms: ${{ env.PLATFORMS }}
outputs: type=tar,dest=/tmp/ccache_export.tar

- name: Extract ccaches
run: |
rm -rf ccache
tar -tvf /tmp/ccache_export.tar
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 }}
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ COPY docker/install_depends.sh /tmp
RUN ./install_depends.sh

COPY --exclude=.git* --link . /rtpproxy/

ARG CCACHE_ROOT

WORKDIR /rtpproxy

RUN /rtpproxy/docker/build.sh
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.export_ccache
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE AS build
4 changes: 2 additions & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" ]
Expand All @@ -39,7 +39,7 @@ ccache --zero-stats

CC=clang-15 AR=llvm-ar-15 RANLIB=llvm-ranlib-15 NM=llvm-nm-15 \
STRIP=llvm-strip-15 CFLAGS="-O3 -pipe" ./configure ${CONFIGURE_ARGS}
make all
make -j all
make install

ccache --show-stats
Expand Down

0 comments on commit beedd78

Please sign in to comment.