Skip to content

tools/ci/docker/linux/Dockerfile: fix ccache when running container as user#13290

Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom
userid0x0:dockerfileUsersupport
Sep 5, 2024
Merged

tools/ci/docker/linux/Dockerfile: fix ccache when running container as user#13290
xiaoxiang781216 merged 1 commit intoapache:masterfrom
userid0x0:dockerfileUsersupport

Conversation

@userid0x0
Copy link
Copy Markdown

Normally ccache places the temporary files in ~/.ccache, when invoking the container with
-u <uid>:<gid>
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.

Summary

Impact

Testing

Before:

# docker run --rm --tty --interactive -u 1000:1000 ghcr.io/apache/nuttx/apache-nuttx-ci-linux:latest
cd /tmp
touch test.c
arm-none-eabi-gcc -c test.c
# ccache: error: Failed to create directory //.cache/ccache/tmp: Permission denied

…s user

Normally ccache places the temporary files in `~/.ccache`, when invoking the container with
  `-u <uid>:<gid>`
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.
@xiaoxiang781216 xiaoxiang781216 merged commit 39937c9 into apache:master Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants