chore(build): Updating build script to take custom docker runtimes

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2024-03-12 15:02:52 +01:00
parent 9e7f1971dd
commit ea54ab181b

View file

@ -14,6 +14,17 @@ image_tag=${IMAGE_TAG:-$git_sha}
ee="false"
# Possible values: amd64, arm64
arch="${ARCH:-"amd64"}"
docker() {
local docker_cmd=${DOCKER_RUNTIME}
[[ $docker_cmd == "docker" ]] && docker_cmd=$(which docker)
if [[ "$1" == "build" ]]; then
shift
# Reconstruct command with DOCKER_ARGS before the '.'
$docker_cmd build "${DOCKER_BUILD_ARGS}" "$@"
else
$docker_cmd "$@"
fi
}
check_prereq() {
which docker || {
@ -46,7 +57,7 @@ update_helm_release() {
function build_service() {
image="$1"
echo "BUILDING $image"
docker build -t ${DOCKER_REPO:-'local'}/$image:${image_tag} --platform linux/$arch --build-arg ARCH=$arch --build-arg SERVICE_NAME=$image --build-arg GIT_SHA=$git_sha --build-arg GSSAPI=${GSSAPI:-'false'} .
docker build -t ${DOCKER_REPO:-'local'}/$image:${image_tag} --platform linux/$arch --build-arg ARCH=$arch --build-arg SERVICE_NAME=$image --build-arg GIT_SHA=$git_sha .
[[ $PUSH_IMAGE -eq 1 ]] && {
docker push ${DOCKER_REPO:-'local'}/$image:${image_tag}
}