Skip to content

Commit

Permalink
Merge pull request #39 from openziti/bugfix-gitconfig
Browse files Browse the repository at this point in the history
ensure global gitconfig file exists and is writable...
  • Loading branch information
qrkourier authored Jul 5, 2024
2 parents eebf786 + 14035ed commit 42219e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENV TZ=UTC
ENV PATH="/usr/local/:${PATH}"
# used by git to find global config in container that is writeable by the
# developer's UID
ENV GIT_CONFIG_GLOBAL="/tmp/ziti-builder-gitconfig"
ENV GIT_CONFIG_GLOBAL="/ziti-builder-gitconfig"
# used by build scripts to detect running in docker
ENV BUILD_ENVIRONMENT="ziti-builder-docker"

Expand All @@ -43,7 +43,6 @@ RUN apt-get update \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf \
gcovr \
git \
gpg \
graphviz \
libcap-dev \
Expand Down Expand Up @@ -71,6 +70,7 @@ RUN curl -sSLf https://apt.llvm.org/llvm-snapshot.gpg.key \

RUN apt-get update \
&& apt-get --yes --quiet --no-install-recommends install \
git \
clang-17 \
clang-tidy-17 \
&& apt-get --yes autoremove \
Expand Down Expand Up @@ -108,6 +108,7 @@ ENV VCPKG_FORCE_SYSTEM_BINARIES=yes
# VCPKG_ROOT is set to filemode 0777 to allow the developer's UID to write the lockfile at build time; and git writes
# global config settings as root in GIT_CONFIG_GLOBAL
RUN cd /usr/local \
&& touch "${GIT_CONFIG_GLOBAL}" \
&& git config --global advice.detachedHead false \
&& git clone --branch "${VCPKG_VERSION}" https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -disableMetrics \
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ set -o pipefail

# duplicate the global gitconfig to a writable location if not root
if (( UID ));then
USER_WRITABLE="${GIT_CONFIG_GLOBAL}-uid-$UID"
cp "$GIT_CONFIG_GLOBAL" "$USER_WRITABLE"
GIT_CONFIG_GLOBAL="$USER_WRITABLE"
USER_WRITABLE="/tmp/$(basename "${GIT_CONFIG_GLOBAL}-uid-${UID}")"
cp "$GIT_CONFIG_GLOBAL" "${USER_WRITABLE}"
GIT_CONFIG_GLOBAL="${USER_WRITABLE}"
fi

exec "$@"

0 comments on commit 42219e1

Please sign in to comment.