Skip to content

Commit

Permalink
Merge pull request #215 from hector-vido/podman
Browse files Browse the repository at this point in the history
Added podman as an alternative engine for builds
  • Loading branch information
k8s-ci-robot authored Mar 3, 2025
2 parents 1230f5b + 4923b6b commit b1dff6c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@ if [[ -z "${DOCKER_TAG:-}" ]]; then
exit 1
fi

docker_build() {
if [[ -z "${CONTAINER_ENGINE:-}" ]]; then
if [[ -x `which docker` ]]; then
CONTAINER_ENGINE=docker
elif [[ -x `which podman` ]]; then
CONTAINER_ENGINE=podman
else
echo "CONTAINER_ENGINE must be set!" >&2
exit 1
fi
fi

image_build() {
local cmd=$1
local image_dir
if [[ -d ./images/"${cmd}" ]]; then
Expand All @@ -39,7 +50,7 @@ docker_build() {
image_dir="default"
fi
# We need to set DOCKER_TAG in the container because git metadata isn't available
docker build --pull \
$CONTAINER_ENGINE build --pull \
--build-arg "DOCKER_TAG=${DOCKER_TAG}" \
--build-arg "go_version=${GO_VERSION}" \
--build-arg "cmd=${cmd}" \
Expand All @@ -48,4 +59,4 @@ docker_build() {
-f "./images/${image_dir}/Dockerfile" .
}

docker_build $@
image_build $@

0 comments on commit b1dff6c

Please sign in to comment.