diff --git a/scripts/build_viewer.sh b/scripts/build_viewer.sh index 1f261543..d910db65 100644 --- a/scripts/build_viewer.sh +++ b/scripts/build_viewer.sh @@ -13,10 +13,15 @@ # limitations under the License. #!/usr/bin/env bash +shopt -s expand_aliases +set -eux ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" BUILD_DIR=$ABSOLUTE_PATH/.. +# Set Docker/Podman alias if necessary +. ${ABSOLUTE_PATH}/setenv.sh + docker build --no-cache -t registry-viewer $BUILD_DIR \ --build-arg PROJECT_NAME=registry-viewer \ --build-arg NEXT_PUBLIC_BASE_PATH=${NEXT_PUBLIC_BASE_PATH:-"/viewer"} diff --git a/scripts/push.sh b/scripts/push.sh index 5fb113cd..29e517a1 100644 --- a/scripts/push.sh +++ b/scripts/push.sh @@ -13,8 +13,16 @@ # limitations under the License. #!/usr/bin/env bash +shopt -s expand_aliases +set -eux BASE_TAG=$1 IMAGE_TAG=$2 + +ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Set Docker/Podman alias if necessary +. ${ABSOLUTE_PATH}/setenv.sh + docker tag $BASE_TAG $IMAGE_TAG docker push $IMAGE_TAG diff --git a/scripts/setenv.sh b/scripts/setenv.sh new file mode 100644 index 00000000..919436b8 --- /dev/null +++ b/scripts/setenv.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# Copyright Red Hat +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script aliases the docker cli if the environment variable USE_PODMAN is set to true. + +# default value is false if USE_PODMAN is unset or null +podman=${USE_PODMAN:-false} +if [ ${podman} == true ]; then + alias docker=podman + echo "setting alias docker=podman" +fi \ No newline at end of file