mirror of https://github.com/WebAssembly/wasi-sdk
When running Git commands inside this Docker container (i.e., commands that the `version.py` script needs for determining version information), the Docker build would run into issues like: ``` fatal: detected dubious ownership in repository at '/workspace' To add an exception for this directory, call: git config --global --add safe.directory /workspace ``` This is due to an extra Git check that detects that the Docker user is not the same one who owns the `.git` directory of this project. After looking into this, the best solution the internet has to offer is to thread the current user's UID and GID through the Docker image (i.e., the new `builder` user) and then `docker run --user ...`. This both avoids the Git check but also seems to be considered a best practice in some circles (?).pull/403/head
parent
0409839729
commit
c376c9cfbd
@ -1,7 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
echo "Building the docker image"
|
||||
docker build -t wasi-sdk-builder:latest .
|
||||
docker build \
|
||||
--build-arg UID=$(id -u) --build-arg GID=$(id -g) \
|
||||
-t wasi-sdk-builder:latest .
|
||||
|
||||
echo "Building the package in docker image"
|
||||
mkdir -p ~/.ccache
|
||||
docker run --rm -v "$PWD":/workspace -v ~/.ccache:/root/.ccache -e NINJA_FLAGS=-v --workdir /workspace --tmpfs /tmp:exec wasi-sdk-builder:latest make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON
|
||||
docker run --rm \
|
||||
--user $(id -u):$(id -g) \
|
||||
-v "$PWD":/workspace:Z \
|
||||
-v ~/.ccache:/home/builder/.ccache:Z \
|
||||
-e NINJA_FLAGS=-v \
|
||||
--tmpfs /tmp:exec \
|
||||
wasi-sdk-builder:latest \
|
||||
make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON
|
||||
|
Loading…
Reference in new issue