Skip to content

Commit

Permalink
feat: allow providing container runtime for multi arch scripts
Browse files Browse the repository at this point in the history
Signed-off-by: shashank381 <satholashashank@gmail.com>
  • Loading branch information
shashank381 committed Mar 21, 2024
1 parent d8dc7fd commit bd679bf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
:: 1) buildandpush_multiarchimages.bat
:: 2) buildandpush_multiarchimages.bat index.docker.io your_registry_namespace
:: 3) buildandpush_multiarchimages.bat quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x
:: 4) ./buildandpush_multiarchimages.bat docker
:: 5) ./buildandpush_multiarchimages.bat podman quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x

@echo off
for /F "delims=" %%i in ("%cd%") do set basename="%%~ni"
Expand All @@ -29,10 +31,18 @@ if not %basename% == "scripts" (
REM go to the parent directory so that all the relative paths will be correct
cd {{ .RelParentOfSourceDir }}


IF "%1"=="docker" (
shift
GOTO DOCKER_CONTAINER_RUNTIME
)
IF "%1"=="podman" (
shift
GOTO PODMAN_CONTAINER_RUNTIME
)
SET CONTAINER_RUNTIME={{ .ContainerRuntime }}
GOTO DOCKER_CONTAINER_RUNTIME


IF "%3"=="" GOTO DEFAULT_PLATFORMS
SET PLATFORMS=%3%
GOTO REGISTRY
Expand Down Expand Up @@ -83,4 +93,4 @@ popd

echo "done"

:SKIP
:SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# 1) ./buildandpush_multiarchimages.sh
# 2) ./buildandpush_multiarchimages.sh index.docker.io your_registry_namespace
# 3) ./buildandpush_multiarchimages.sh quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x
# 4) ./buildandpush_multiarchimages.sh docker
# 5) ./buildandpush_multiarchimages.sh podman quay.io your_quay_username linux/amd64,linux/arm64,linux/s390x

if [[ "$(basename "$PWD")" != 'scripts' ]] ; then
echo 'please run this script from the "scripts" directory'
Expand All @@ -29,6 +31,13 @@ cd {{ .RelParentOfSourceDir }} # go to the parent directory so that all the rela
REGISTRY_URL={{ .RegistryURL }}
REGISTRY_NAMESPACE={{ .RegistryNamespace }}
PLATFORMS="linux/amd64,linux/arm64,linux/s390x,linux/ppc64le"
CONTAINER_RUNTIME={{ .ContainerRuntime }}

if [ "$#" -gt 0 ] && [[ "$1" == "docker" || "$1" == "podman" ]]; then
CONTAINER_RUNTIME=$1
shift;
fi

if [ "$#" -gt 1 ]; then
REGISTRY_URL=$1
REGISTRY_NAMESPACE=$2
Expand All @@ -37,7 +46,6 @@ if [ "$#" -eq 3 ]; then
PLATFORMS=$3
fi

CONTAINER_RUNTIME={{ .ContainerRuntime }}
if [ "${CONTAINER_RUNTIME}" != "docker" ] && [ "${CONTAINER_RUNTIME}" != "podman" ]; then
echo 'Unsupported container runtime passed as an argument for building the images: '"${CONTAINER_RUNTIME}"
exit 1
Expand Down

0 comments on commit bd679bf

Please sign in to comment.