X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pm-rapp%2Fbuild.sh;h=9bc6810b8d33b80eee6244fff8f1107161c5cf8a;hb=f5220f5955d8599e5c247bf432fe65c83e8a65c1;hp=581b5c28be0a49d8d232d92d4aa35f5af670e8b2;hpb=c5655db5780275b07b25b57b767808f2f1eac7d9;p=nonrtric%2Fplt%2Franpm.git diff --git a/pm-rapp/build.sh b/pm-rapp/build.sh index 581b5c2..9bc6810 100755 --- a/pm-rapp/build.sh +++ b/pm-rapp/build.sh @@ -18,7 +18,7 @@ # # Build image from Dockerfile with/without custom image tag -# Optionally push to external docker hub repo +# Optionally push to external image repo print_usage() { echo "Usage: build.sh no-push| []" @@ -39,12 +39,30 @@ else echo "Attempt to push built image to: "$REPO fi -if [ "$2" != "" ]; then - IMAGE_TAG=$2 -fi - echo "Setting image tag to: "$IMAGE_TAG +shift +while [ $# -ne 0 ]; do + if [ $1 == "--tag" ]; then + shift + if [ -z "$1" ]; then + print_usage + fi + IMAGE_TAG=$1 + echo "Setting image tag to: "$IMAGE_TAG + shift + else + echo "Unknown parameter: $1" + print_usage + fi +done IMAGE=$IMAGE_NAME:$IMAGE_TAG + +export DOCKER_DEFAULT_PLATFORM=linux/amd64 +CURRENT_PLATFORM=$(docker system info --format '{{.OSType}}/{{.Architecture}}') +if [ $CURRENT_PLATFORM != $DOCKER_DEFAULT_PLATFORM ]; then + echo "Image may not work on the current platform: $CURRENT_PLATFORM, only platform $DOCKER_DEFAULT_PLATFORM supported" +fi + echo "Building image $IMAGE" docker build -t $IMAGE_NAME:$IMAGE_TAG . if [ $? -ne 0 ]; then