Skip to content

Commit

Permalink
Fix the ability to specify a git directory
Browse files Browse the repository at this point in the history
  • Loading branch information
flounderpinto committed Dec 12, 2023
1 parent c531bd7 commit 84f0321
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ DOCKER_PLATFORM=linux/amd64
#To prevent the circular dependency, this repo calls the dockerBuild script directly
# instead of through the builder-docker image.
docker:
./src/dockerBuild.sh dockerBuild -e ${DOCKER_REGISTRY} -r ${DOCKER_REPO} -p ${DOCKER_PLATFORM} -d "." -f ./docker/Dockerfile ${ARGS}
./src/dockerBuild.sh \
dockerBuild \
-e ${DOCKER_REGISTRY} \
-r ${DOCKER_REPO} \
-p ${DOCKER_PLATFORM} \
-d "." \
-g "." \
-f ./docker/Dockerfile \
${ARGS}

#Everything right of the pipe is order-only prerequisites.
all: | docker
6 changes: 3 additions & 3 deletions src/dockerBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ function dockerBuild
exit 1
fi

#If not git repo provided, default to current directory
#If not git repo provided, default to the code dir
if [ -z "$GIT_DIR" ]; then
GIT_DIR="./.git"
GIT_DIR="$CODE_DIR/.git"
fi

#Default is to just tag with the git version.
Expand All @@ -127,7 +127,7 @@ function dockerBuild

#Find the current git branch.
local gitBranch=""
gitBranch=$(git branch --show-current)
gitBranch=$(git --git-dir "$GIT_DIR" branch --show-current)
if [ -z "$gitBranch" ]; then
echo "Could not determine git branch name, caching to main."
gitBranch="$MAIN_BRANCH"
Expand Down

0 comments on commit 84f0321

Please sign in to comment.