Skip to content

Commit f25c0e2

Browse files
committed
makefile: add task to generate buildx YAML docs from remote definition
Signed-off-by: CrazyMax <[email protected]>
1 parent 8a64871 commit f25c0e2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Makefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ifneq (, $(BUILDX_BIN))
2+
export BUILDX_CMD = $(BUILDX_BIN)
3+
else ifneq (, $(shell docker buildx version))
4+
export BUILDX_CMD = docker buildx
5+
else ifneq (, $(shell which buildx))
6+
export BUILDX_CMD = $(which buildx)
7+
else
8+
$(error "Buildx is required: https://github.com/docker/buildx#installing")
9+
endif
10+
11+
BUILDX_REPO ?= https://github.com/docker/buildx.git
12+
BUILDX_REF ?= master
13+
14+
# Generate YAML docs from remote bake definition
15+
# Usage BUILDX_REF=v0.7.0 make buildx-yaml
16+
buildx-yaml:
17+
$(eval $@_TMP_OUT := $(shell mktemp -d -t docs-output.XXXXXXXXXX))
18+
DOCS_FORMATS=yaml $(BUILDX_CMD) bake --set "*.output=$($@_TMP_OUT)" "$(BUILDX_REPO)#$(BUILDX_REF)" update-docs
19+
rm -rf ./_data/buildx/*
20+
cp -R "$($@_TMP_OUT)"/out/reference/*.yaml ./_data/buildx/
21+
rm -rf $($@_TMP_OUT)/*

0 commit comments

Comments
 (0)