From 39937c9685d4a021bd50a7259572f33dc05f7d37 Mon Sep 17 00:00:00 2001 From: Alexander Merkle Date: Wed, 4 Sep 2024 09:35:32 +0200 Subject: [PATCH] tools/ci/docker/linux/Dockerfile: fix ccache when running container as user Normally ccache places the temporary files in `~/.ccache`, when invoking the container with `-u :` as e.g. Jenkins does, this might result in a invalid/unknown home folder. Thus ccache tries to write to `/.ccache` which doesn't exist and the user doesn't have any permissions. Explicitly set `CCACHE_DIR` to a folder with appropriate permissions. --- tools/ci/docker/linux/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/ci/docker/linux/Dockerfile b/tools/ci/docker/linux/Dockerfile index 5f63089bec..7a5aa19fbc 100644 --- a/tools/ci/docker/linux/Dockerfile +++ b/tools/ci/docker/linux/Dockerfile @@ -498,7 +498,10 @@ ENV ZAP_INSTALL_PATH=/tools/zap_release ENV ZAP_DEVELOPMENT_PATH=/tools/zap # Configure ccache -RUN mkdir -p /tools/ccache/bin && \ +# use `/ccache` as cachedir for all users +RUN mkdir -p /ccache && \ + chmod 666 /ccache && \ + mkdir -p /tools/ccache/bin && \ ln -sf `which ccache` /tools/ccache/bin/aarch64-none-elf-gcc && \ ln -sf `which ccache` /tools/ccache/bin/aarch64-none-elf-g++ && \ ln -sf `which ccache` /tools/ccache/bin/arm-none-eabi-gcc && \ @@ -527,5 +530,6 @@ RUN mkdir -p /tools/ccache/bin && \ ln -sf `which ccache` /tools/ccache/bin/xtensa-esp32s3-elf-g++ ENV PATH="/tools/ccache/bin:$PATH" +ENV CCACHE_DIR="/ccache" CMD [ "/bin/bash" ]