docs: update warning message and formatting in containers.mk

Co-authored-by: aider (ollama_chat/gpt-oss:120b) <aider@aider.chat>
This commit is contained in:
2025-11-30 18:46:30 -06:00
parent 657b37eb0c
commit de1593a2a1

View File

@@ -1,35 +1,34 @@
# Get the container (Podman is preferred, but docker can be used too. It may failed with Docker.) # Get the container (Podman is preferred, but docker can be used too. It may failed with Docker.)
# TODO: propose nerdctl # TODO: propose nerdctl
CTN:=$(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker") CTN := $(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker")
ifeq ($(CTN),podman) ifeq ($(CTN),podman)
CTN_USERMAP=--userns=keep-id CTN_USERMAP = --userns=keep-id
else else
$(MAKE) warn-docker $(warning Warning: Docker is not recommended, use Podman instead.)
CTN_USERMAP=--user=$(shell id -u):$(shell id -g) -e HOME=/tmp CTN_USERMAP = --user=$(shell id -u):$(shell id -g) -e HOME=/tmp
endif endif
# Packaging OCI image, to build rpm, deb, pacman, tar packages # 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. # 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... # For Docker, as it doesn't support userns, we use common options, but it may fail...
PKG_OCI_IMAGE=packaging:fedora PKG_OCI_IMAGE = packaging:fedora
ifeq ($(CTN),podman) ifeq ($(CTN),podman)
# podman # podman
PKG_OCI_OPTS:=--rm -it \ PKG_OCI_OPTS := --rm -it \
-v ./:/opt/katenary:z \ -v ./:/opt/katenary:z \
--userns keep-id:uid=1001,gid=1001 \ --userns keep-id:uid=1001,gid=1001 \
$(PKG_OCI_IMAGE) $(PKG_OCI_IMAGE)
else else
# docker # docker
PKG_OCI_OPTS:=--rm -it \ PKG_OCI_OPTS := --rm -it \
-v ./:/opt/katenary:z \ -v ./:/opt/katenary:z \
-e HOME=/tmp \ -e HOME=/tmp \
$(CTN_USERMAP) \ $(CTN_USERMAP) \
$(PKG_OCI_IMAGE) $(PKG_OCI_IMAGE)
endif endif
BUILD_IMAGE=docker.io/golang:$(GOVERSION) BUILD_IMAGE = docker.io/golang:$(GOVERSION)
GO_OCI:=$(CTN) run --rm -it \ GO_OCI := $(CTN) run --rm -it \
-v $(PWD):/go/src/katenary:z \ -v $(PWD):/go/src/katenary:z \
-w /go/src/katenary \ -w /go/src/katenary \
-e CGO_ENABLED=$(CGO_ENABLED) \ -e CGO_ENABLED=$(CGO_ENABLED) \
@@ -44,6 +43,7 @@ packager-oci-image:
builder-oci-image: builder-oci-image:
@$(CTN) build -t go-builder:$(GOVERSION) ./oci/builder \ @$(CTN) build -t go-builder:$(GOVERSION) ./oci/builder \
--build-arg GOVERSION=$(GOVERSION) 1>/dev/null --build-arg GOVERSION=$(GOVERSION) 1>/dev/null
katenary-oci: katenary-oci:
VERSION=$(VERSION) \ VERSION=$(VERSION) \
VERSION=$${VERSION#releases/}; \ VERSION=$${VERSION#releases/}; \