From 6ae3b25b4d7960b8168bd8eabc403152c4d02ea5 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Sun, 6 Jul 2025 21:17:31 +0000 Subject: [PATCH] Use the -v flag on podman only Docker does not support the --volume flag at build time. This needs to be done in the Dockerfile directly on the RUN stanza. Will update in a future PR, until then, just set the flag for podman. Signed-off-by: Gabriel Adrian Samfira --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3747ad24..9a09e999 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,9 @@ GEN_PASSWORD=$(shell (/usr/bin/apg -n1 -m32)) IMAGE_TAG = garm-build IMAGE_BUILDER=$(shell (which docker || which podman)) -USER_ID=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "0" || id -u)) -USER_GROUP=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "0" || id -g)) +IS_PODMAN=$(shell (($(IMAGE_BUILDER) --version | grep -q podman) && echo "yes" || echo "no")) +USER_ID=$(if $(filter yes,$(IS_PODMAN)),0,$(shell id -u)) +USER_GROUP=$(if $(filter yes,$(IS_PODMAN)),0,$(shell id -g)) ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) GOPATH ?= $(shell go env GOPATH) VERSION ?= $(shell git describe --tags --match='v[0-9]*' --dirty --always) @@ -21,6 +22,11 @@ export CREDENTIALS_NAME ?= test-garm-creds export WORKFLOW_FILE_NAME ?= test.yml export GARM_ADMIN_USERNAME ?= admin +ifeq ($(IS_PODMAN),yes) + EXTRA_ARGS := -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt +endif + + .PHONY: help help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @@ -33,7 +39,7 @@ default: build .PHONY : build-static test install-lint-deps lint go-test fmt fmtcheck verify-vendor verify create-release-files release build-static: ## Build garm statically @echo Building garm - $(IMAGE_BUILDER) build -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt --tag $(IMAGE_TAG) -f Dockerfile.build-static . + $(IMAGE_BUILDER) build $(EXTRA_ARGS) --tag $(IMAGE_TAG) -f Dockerfile.build-static . mkdir -p build $(IMAGE_BUILDER) run --rm -e USER_ID=$(USER_ID) -e GARM_REF=$(GARM_REF) -e USER_GROUP=$(USER_GROUP) -v $(PWD)/build:/build/output:z $(IMAGE_TAG) /build-static.sh @echo Binaries are available in $(PWD)/build