|
|
@@ -34,6 +34,13 @@ SRCDIR := $(ROOT)/docs
|
|
|
CFGFILE := $(ROOT)/hack/api-docs/mkdocs.yml
|
|
|
# GENROOT is the root of the generated documentation.
|
|
|
GENROOT := $(ROOT)/site
|
|
|
+GIT_DIR := $(shell cd $(ROOT) && git rev-parse --path-format=absolute --git-dir)
|
|
|
+GIT_COMMON_DIR := $(shell cd $(ROOT) && git rev-parse --path-format=absolute --git-common-dir)
|
|
|
+ifeq ($(shell test -f $(ROOT)/.git && echo true),true)
|
|
|
+GIT_METADATA_MOUNTS := \
|
|
|
+ --mount type=bind,source=$(GIT_DIR),target=$(GIT_DIR) \
|
|
|
+ --mount type=bind,source=$(GIT_COMMON_DIR),target=$(GIT_COMMON_DIR)
|
|
|
+endif
|
|
|
|
|
|
# Grab the uid/gid to fix permissions due to running in a docker container.
|
|
|
GID := $(shell id -g)
|
|
|
@@ -61,6 +68,7 @@ build: image generate $(SOURCES)
|
|
|
mkdir -p $(GENROOT)
|
|
|
$(DOCKER) run \
|
|
|
--mount type=bind,source=$(ROOT),target=/repo \
|
|
|
+ $(GIT_METADATA_MOUNTS) \
|
|
|
--sig-proxy=true \
|
|
|
--rm \
|
|
|
--env "GIT_COMMITTER_NAME=$(shell git config user.name)" \
|
|
|
@@ -73,6 +81,7 @@ build.publish: image generate $(SOURCES)
|
|
|
mkdir -p $(GENROOT)
|
|
|
$(DOCKER) run \
|
|
|
--mount type=bind,source=$(ROOT),target=/repo \
|
|
|
+ $(GIT_METADATA_MOUNTS) \
|
|
|
--sig-proxy=true \
|
|
|
--rm \
|
|
|
--user $(UID):$(GID) \
|
|
|
@@ -97,6 +106,7 @@ serve: image generate
|
|
|
-it \
|
|
|
--sig-proxy=true \
|
|
|
--mount type=bind,source=$(ROOT),target=/repo \
|
|
|
+ $(GIT_METADATA_MOUNTS) \
|
|
|
--user $(UID):$(GID) \
|
|
|
-p $(SERVE_BIND_ADDRESS):8000:8000 \
|
|
|
--rm \
|