diff --git a/Makefile b/Makefile index 41ef175d..89e8c950 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,16 @@ install-tekton-pipelines: ## Install Tekton pipelines in KinD cluster. .PHONY: install-tekton-pipelines build-and-push-images: ## Build and push images to local registry. - cd scripts && ./build-and-push-images.sh + cd scripts && ./build-and-push-images.sh --image start + cd scripts && ./build-and-push-images.sh --image finish + cd scripts && ./build-and-push-images.sh --image buildah + cd scripts && ./build-and-push-images.sh --image sonar + cd scripts && ./build-and-push-images.sh --image webhook-interceptor + cd scripts && ./build-and-push-images.sh --image go-toolset + cd scripts && ./build-and-push-images.sh --image gradle-toolset + cd scripts && ./build-and-push-images.sh --image python-toolset + cd scripts && ./build-and-push-images.sh --image helm + cd scripts && ./build-and-push-images.sh --image node16-typescript-toolset --platform linux/amd64 .PHONY: build-and-push-images install-ods-tasks-kind: ## KinD only! Apply ODS ClusterTask manifests in KinD diff --git a/scripts/build-and-push-images.sh b/scripts/build-and-push-images.sh index a669369f..d7a8a5b7 100755 --- a/scripts/build-and-push-images.sh +++ b/scripts/build-and-push-images.sh @@ -14,6 +14,9 @@ IMAGES="" http_proxy="${http_proxy:-}" https_proxy="${https_proxy:-}" +PLATFORM="" +# eg. --platform linux/amd64 + while [[ "$#" -gt 0 ]]; do case $1 in @@ -24,6 +27,9 @@ while [[ "$#" -gt 0 ]]; do -i|--image) IMAGES="$2"; shift;; -i=*|--image=*) IMAGES="${1#*=}";; + -p|--platform) PLATFORM="$2"; shift;; + -p=*|--platform=*) PLATFORM="${1#*=}";; + *) echo "Unknown parameter passed: $1"; exit 1;; esac; shift; done @@ -33,7 +39,8 @@ build_and_push_image() { odsImage="ods-$image" if [ "${SKIP_BUILD}" != "true" ]; then echo "Building image $REGISTRY/$NAMESPACE/$odsImage..." - docker build \ + # shellcheck disable=SC2086 + docker build $platform_arg \ --build-arg http_proxy="$http_proxy" \ --build-arg https_proxy="$https_proxy" \ --build-arg HTTP_PROXY="$http_proxy" \ @@ -44,6 +51,11 @@ build_and_push_image() { docker push "$REGISTRY/$NAMESPACE/$odsImage" } +platform_arg= +if [ -n "$PLATFORM" ]; then + platform_arg="--platform=${PLATFORM}" +fi + if [ -z "$IMAGES" ]; then for file in build/package/Dockerfile.*; do image=${file##*Dockerfile.}