From d8332d6559abc33cc676a6d265e7f5a074110cd6 Mon Sep 17 00:00:00 2001 From: ashwin1111 Date: Thu, 14 Nov 2024 19:06:48 +0530 Subject: [PATCH] feat: Support for build path --- build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b0489df..1cf0945 100644 --- a/build.sh +++ b/build.sh @@ -3,6 +3,9 @@ # Fail fast set -e +# Default build path is current directory if not specified +DOCKER_BUILD_PATH=${DOCKER_BUILD_PATH:-.} + branch_name=$(git branch --show-current) if [[ "$branch_name" == *release* ]]; then @@ -29,9 +32,9 @@ echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT docker login --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASSWORD if [ -n "$SENTRY_AUTH_TOKEN" ]; then - docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG --build-arg ssh_prv_key="$SSH_PRIVATE_KEY" --build-arg SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" . + docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG --build-arg ssh_prv_key="$SSH_PRIVATE_KEY" --build-arg SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" -f $DOCKER_BUILD_PATH/Dockerfile $DOCKER_BUILD_PATH else - docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG --build-arg ssh_prv_key="$SSH_PRIVATE_KEY" . + docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG --build-arg ssh_prv_key="$SSH_PRIVATE_KEY" -f $DOCKER_BUILD_PATH/Dockerfile $DOCKER_BUILD_PATH fi echo "Pushing Docker Image to Docker Hub"; docker push $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG