Skip to content

Commit be187ba

Browse files
gloursndeloof
authored andcommitted
use a temp directory to generate doc to be sure working tree is clean
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 099715f commit be187ba

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ lint: ## run linter(s)
8484

8585
.PHONY: docs
8686
docs: ## generate documentation
87-
@docker build . \
88-
--output type=local,dest=./docs/ \
87+
$(eval $@_TMP_OUT := $(shell mktemp -d -t dockercli-output.XXXXXXXXXX))
88+
docker build . \
89+
--output type=local,dest=$($@_TMP_OUT) \
8990
-f ./docs/docs.Dockerfile \
9091
--target update
92+
rm -rf ./docs/internal
93+
cp -R "$($@_TMP_OUT)"/out/* ./docs/
94+
rm -rf "$($@_TMP_OUT)"/*
9195

9296
.PHONY: validate-docs
9397
validate-docs: ## validate the doc does not change

docs/docs.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cp -r docs/reference /out
3939
EOT
4040

4141
FROM scratch AS update
42-
COPY --from=gen /out /
42+
COPY --from=gen /out /out
4343

4444
FROM gen AS validate
4545
RUN --mount=target=/context \

0 commit comments

Comments
 (0)