Skip to content

Commit 72dfc78

Browse files
committed
fix: change Git config inside Docker container
1 parent 59e5556 commit 72dfc78

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ package: build/package.BUILT
254254

255255
build/package.BUILT: build strip
256256
mkdir -p dist
257+
./docker_ensure_git_access.sh
257258
./deb_from_installation.sh $(shell pwd)/dist "$(VERSION)" "$(BUILD_PREFIX)"
258259
./tar_from_installation.sh "$(shell pwd)/dist" "$(VERSION)" "$(BUILD_PREFIX)"
259260
touch build/package.BUILT

docker_build.sh

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ set -ex
44
echo "Building the docker image"
55
docker build -t wasi-sdk-builder:latest .
66

7-
if ! git config safe.directory | grep --quiet /workspace; then
8-
echo "Setting up Git safe directory"
9-
git config --global --add safe.directory /workspace
10-
fi
11-
127
echo "Building the package in docker image"
138
mkdir -p ~/.ccache
149
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_ensure_git_access.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
# When running any git command inside a Docker container the user is different
4+
# than usual so Git thinks something fishy is going on. Git will print something
5+
# like:
6+
#
7+
# > fatal: detected dubious ownership in repository at '/workspace'
8+
# > To add an exception for this directory, call:
9+
# >
10+
# > git config --global --add safe.directory /workspace
11+
#
12+
# This script runs that command to avoid this error.
13+
14+
set -ex
15+
if ! git config safe.directory | grep --quiet /workspace; then
16+
echo "Setting up Git safe directory"
17+
git config --global --add safe.directory /workspace
18+
fi

0 commit comments

Comments
 (0)