Skip to content

Commit

Permalink
Merge pull request #108 from Jdubrick/main
Browse files Browse the repository at this point in the history
add podman script/alias support to build and push scripts
  • Loading branch information
Jdubrick authored Nov 20, 2023
2 parents 36efa79 + 99ac9df commit 2223f1b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build_viewer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
8 changes: 8 additions & 0 deletions scripts/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions scripts/setenv.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2223f1b

Please sign in to comment.