Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nacx committed Mar 5, 2024
1 parent 5b0610d commit b30f5d7
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions run-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,13 @@ ROOT=$(git rev-parse --show-toplevel)
GO_VERSION=$(sed -ne 's/^go //gp' "${ROOT}/go.mod")
BUILD_IMAGE="golang:${GO_VERSION}"

# Create a git config to let Git trust the directory where we will mount the source code
TMPGITCONFIG=$(mktemp)
cat <<EOF > "${TMPGITCONFIG}"
[safe]
directory = /opt/src
EOF

docker run \
--rm \
--platform "${1}" \
-v "${PWD}":/opt/src \
-v "$(go env GOMODCACHE)":/go/pkg/mod \
-v "${TMPGITCONFIG}:/.gitconfig" \
-e GOPROXY="$(go env GOPROXY)" \
-e GOPRIVATE="$(go env GOPRIVATE)" \
-w /opt/src \
"${BUILD_IMAGE}" \
/bin/bash -c "${*:2}"

rm -f "${TMPGITCONFIG}"
/bin/bash -c "git config --global --add safe.directory /opt/src ; ${*:2}"

0 comments on commit b30f5d7

Please sign in to comment.