use a temp directory to generate doc to be sure working tree is clean

Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
This commit is contained in:
Guillaume Lours 2022-03-17 14:47:26 +01:00 committed by Nicolas De loof
parent 099715fb6f
commit be187bae64
2 changed files with 7 additions and 3 deletions

View File

@ -84,10 +84,14 @@ lint: ## run linter(s)
.PHONY: docs .PHONY: docs
docs: ## generate documentation docs: ## generate documentation
@docker build . \ $(eval $@_TMP_OUT := $(shell mktemp -d -t dockercli-output.XXXXXXXXXX))
--output type=local,dest=./docs/ \ docker build . \
--output type=local,dest=$($@_TMP_OUT) \
-f ./docs/docs.Dockerfile \ -f ./docs/docs.Dockerfile \
--target update --target update
rm -rf ./docs/internal
cp -R "$($@_TMP_OUT)"/out/* ./docs/
rm -rf "$($@_TMP_OUT)"/*
.PHONY: validate-docs .PHONY: validate-docs
validate-docs: ## validate the doc does not change validate-docs: ## validate the doc does not change

View File

@ -39,7 +39,7 @@ cp -r docs/reference /out
EOT EOT
FROM scratch AS update FROM scratch AS update
COPY --from=gen /out / COPY --from=gen /out /out
FROM gen AS validate FROM gen AS validate
RUN --mount=target=/context \ RUN --mount=target=/context \