forked from Katenary/katenary
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:
@@ -1,35 +1,34 @@
|
||||
|
||||
# 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")
|
||||
CTN := $(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker")
|
||||
ifeq ($(CTN),podman)
|
||||
CTN_USERMAP=--userns=keep-id
|
||||
CTN_USERMAP = --userns=keep-id
|
||||
else
|
||||
$(MAKE) warn-docker
|
||||
CTN_USERMAP=--user=$(shell id -u):$(shell id -g) -e HOME=/tmp
|
||||
$(warning Warning: Docker is not recommended, use Podman instead.)
|
||||
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
|
||||
PKG_OCI_IMAGE = packaging:fedora
|
||||
ifeq ($(CTN),podman)
|
||||
# podman
|
||||
PKG_OCI_OPTS:=--rm -it \
|
||||
# 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 \
|
||||
# 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)
|
||||
BUILD_IMAGE = docker.io/golang:$(GOVERSION)
|
||||
|
||||
GO_OCI:=$(CTN) run --rm -it \
|
||||
GO_OCI := $(CTN) run --rm -it \
|
||||
-v $(PWD):/go/src/katenary:z \
|
||||
-w /go/src/katenary \
|
||||
-e CGO_ENABLED=$(CGO_ENABLED) \
|
||||
@@ -44,6 +43,7 @@ packager-oci-image:
|
||||
builder-oci-image:
|
||||
@$(CTN) build -t go-builder:$(GOVERSION) ./oci/builder \
|
||||
--build-arg GOVERSION=$(GOVERSION) 1>/dev/null
|
||||
|
||||
katenary-oci:
|
||||
VERSION=$(VERSION) \
|
||||
VERSION=$${VERSION#releases/}; \
|
||||
|
||||
Reference in New Issue
Block a user