2025-08-03 14:15:35 +02:00
|
|
|
|
|
|
|
# Get the container (Podman is preferred, but docker can be used too. It may failed with Docker.)
|
|
|
|
# TODO: propose nerdctl
|
|
|
|
CTN:=$(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker")
|
|
|
|
ifeq ($(CTN),podman)
|
|
|
|
CTN_USERMAP=--userns=keep-id
|
|
|
|
else
|
|
|
|
$(MAKE) warn-docker
|
|
|
|
CTN_USERMAP=--user=$(shell id -u):$(shell id -g) -e HOME=/tmp
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Packaging OCI image, to build rpm, deb, pacman, tar packages
|
|
|
|
# We changes the keep-id uid/gid for Podman, so that the user inside the container is the same as the user outside.
|
|
|
|
# For Docker, as it doesn't support userns, we use common options, but it may fail...
|
|
|
|
PKG_OCI_IMAGE=packaging:fedora
|
|
|
|
ifeq ($(CTN),podman)
|
|
|
|
# podman
|
|
|
|
PKG_OCI_OPTS:=--rm -it \
|
|
|
|
-v ./:/opt/katenary:z \
|
|
|
|
--userns keep-id:uid=1001,gid=1001 \
|
|
|
|
$(PKG_OCI_IMAGE)
|
|
|
|
else
|
|
|
|
# docker
|
|
|
|
PKG_OCI_OPTS:=--rm -it \
|
|
|
|
-v ./:/opt/katenary:z \
|
|
|
|
-e HOME=/tmp \
|
|
|
|
$(CTN_USERMAP) \
|
|
|
|
$(PKG_OCI_IMAGE)
|
|
|
|
endif
|
|
|
|
BUILD_IMAGE=docker.io/golang:$(GOVERSION)
|
|
|
|
|
|
|
|
GO_OCI:=$(CTN) run --rm -it \
|
|
|
|
-v $(PWD):/go/src/katenary:z \
|
|
|
|
-w /go/src/katenary \
|
|
|
|
-e CGO_ENABLED=$(CGO_ENABLED) \
|
|
|
|
-e GOOS=$(GOOS) \
|
|
|
|
-e GOARCH=$(GOARCH) \
|
|
|
|
$(CTN_USERMAP) \
|
|
|
|
go-builder:$(GOVERSION)
|
|
|
|
|
|
|
|
packager-oci-image:
|
|
|
|
@$(CTN) build -t packaging:fedora ./oci/packager 1>/dev/null
|
|
|
|
|
|
|
|
builder-oci-image:
|
|
|
|
@$(CTN) build -t go-builder:$(GOVERSION) ./oci/builder \
|
|
|
|
--build-arg GOVERSION=$(GOVERSION) 1>/dev/null
|
2025-08-04 16:13:35 +02:00
|
|
|
katenary-oci:
|
2025-08-22 08:33:32 +00:00
|
|
|
VERSION=$(VERSION) \
|
|
|
|
VERSION=$${VERSION#releases/}; \
|
|
|
|
$(CTN) build -f oci/katenary/Containerfile -t katenary:$$VERSION \
|
2025-08-04 16:13:35 +02:00
|
|
|
--build-arg GOVERSION=$(GOVERSION) \
|
|
|
|
--build-arg VERSION=$(VERSION) \
|
|
|
|
./
|
2025-08-22 08:33:32 +00:00
|
|
|
$(CTN) tag katenary:$$VERSION katenary:latest
|