diff options
author | Ivan Zorin <[email protected]> | 2023-08-09 08:38:45 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2023-08-09 05:38:45 +0000 |
commit | 130e73c1fe2fd51e521c42f53d4c71e18c14e096 (patch) | |
tree | 6c0415d5a36e313ac61dbb97a14655afa60be1a6 | |
parent | d5035bb9563c6eec8c8cc3ac61a428602dc9f2ab (diff) | |
download | IronOS-130e73c1fe2fd51e521c42f53d4c71e18c14e096.tar.gz IronOS-130e73c1fe2fd51e521c42f53d4c71e18c14e096.zip |
Make `make docker-clean` to remove docker build cache (#1790)
Makefile: add docker-clean sub-targets to remove not only image but cache (eats lot of space sometimes) & update help output / add clean-up of docker cache to deploy.sh as well
Co-authored-by: Ben V. Brown <[email protected]>
-rw-r--r-- | Makefile | 36 | ||||
-rwxr-xr-x | scripts/deploy.sh | 3 |
2 files changed, 24 insertions, 15 deletions
@@ -79,16 +79,18 @@ help: list:
@echo
@echo "Supported top-level targets:"
- @echo " * help - shows short basic help"
- @echo " * list - this output"
- @echo " * docker-shell - start docker container with shell inside to work on IronOS with all tools needed"
- @echo " * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\""
- @echo " * docker-clean - delete created docker container (but not pre-downloaded data for it)"
- @echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
- @echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
- @echo " * tests - run set of checks, linters & tests (equivalent of github CI IronOS project settings for push trigger)"
- @echo " * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
- @echo " * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
+ @echo " * help - shows short basic help"
+ @echo " * list - this output"
+ @echo " * docker-shell - start docker container with shell inside to work on IronOS with all tools needed"
+ @echo " * docker-build - compile builds of IronOS for supported models inside docker container and place them to $(OUT_DIR) (set OUT env var to override: OUT=/path/to/dir make ...)"
+ @echo " * docker-clean - delete created docker image for IronOS & its build cache objects (to free a lot of space)"
+ @echo " * docker-clean-cache - delete build cache objects of IronOS docker image EXCEPT the image itself"
+ @echo " * docker-clean-image - delete docker image for IronOS EXCEPT its build cache objects"
+ @echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
+ @echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
+ @echo " * tests - run set of checks, linters & tests (equivalent of github CI IronOS project settings for push trigger)"
+ @echo " * clean-build - delete generated files & dirs produced during builds EXCEPT docker image & its build cache"
+ @echo " * clean-full - delete generated files & dirs produced during builds INCLUDING docker image & its build cache"
@echo ""
@echo "NOTES on supported pass-trough targets:"
@echo " * main Makefile is located in source/ directory and used to build the firmware itself;"
@@ -123,10 +125,17 @@ docker-shell: docker-check $(DOCKER_DEPS) docker-build: docker-check $(DOCKER_DEPS)
$(DOCKER_CMD) make build-all
-# delete container
-docker-clean: docker-check
+# delete docker image
+docker-clean-image:
-docker rmi ironos-builder:latest
+# delete docker build cache objects
+docker-clean-cache:
+ -docker system prune --filter label=ironos-builder:latest --force
+
+# delete docker image & cache related to IronOS container
+docker-clean: docker-clean-image docker-clean-cache
+
# generate docs in site/ directory (DIR for -d is relative to mkdocs.yml file location, hence use default name/location site by setting up ../site)
docs: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/*
$(MKDOCS) build -f $(MKDOCS_YML) -d ../site
@@ -222,7 +231,6 @@ ci: tests build-all build-multilang clean-build:
$(MAKE) -C source/ clean-all
rm -Rf site
- rm -Rf scripts/ci/artefacts
rm -Rf $(OUT_DIR)
# global clean-up target
@@ -230,7 +238,7 @@ clean-full: clean-build docker-clean # phony targets
.PHONY: help list
-.PHONY: docker-check docker-shell docker-build docker-clean
+.PHONY: docker-check docker-shell docker-build docker-clean-image docker-clean-cache docker-clean
.PHONY: docs docs-deploy
.PHONY: test-md test-sh test-py test-ccpp tests
.PHONY: build-all build-multilang ci
diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 28057788..f7964ce4 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -17,7 +17,7 @@ usage() echo "CMD (docker related):" echo -e "\tshell - start docker container with shell inside to work on IronOS with all tools needed" echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware" - echo -e "\tclean - delete created docker container (but not pre-downloaded data for it)\n" + echo -e "\tclean - delete created docker image for IronOS & its build cache objects\n" echo "CMD (helper routines):" echo -e "\tdocs_readme - generate & OVERWRITE(!) README.md inside Documentation/ based on nav section from mkdocs.yml if it changed\n" echo -e "\tcheck_style_file SRC - run code style checks based on clang-format & custom parsers for source code file SRC\n" @@ -194,6 +194,7 @@ elif [ "${cmd}" = "build" ]; then docker_cmd="run --rm builder make build-all OUT=${OUT}" elif [ "${cmd}" = "clean" ]; then docker rmi ironos-builder:latest + docker system prune --filter label=ironos-builder:latest --force exit "${?}" else usage |