diff --git a/Makefile b/Makefile index 0f21774fa..3364e7781 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ else BUILD_STACK_TARGETS = build-in-docker endif -.PHONY: all apt-update install version copyfiles copyplugin dokku-lib-dirs man-db plugins dependencies docker-image-labeler lambda-builder netrc sshcommand procfile-util plugn docker aufs stack count vagrant-acl-add vagrant-dokku go-build wget +.PHONY: all apt-update install version copyfiles copyplugin dokku-lib-dirs check-dependencies man-db plugins dependencies docker-image-labeler lambda-builder netrc sshcommand procfile-util plugn docker aufs stack count vagrant-acl-add vagrant-dokku go-build wget include docs.mk include tests.mk @@ -42,7 +42,29 @@ include arch.mk all: # Type "make install" to install. -install: dependencies version copyfiles dokku-lib-dirs plugin-dependencies plugins +install: dependencies check-dependencies version copyfiles dokku-lib-dirs plugin-dependencies plugins + +# tools the install and every deploy rely on; docker compose may come from +# either the standalone binary or the compose plugin shipped with docker +REQUIRED_COMMANDS ?= curl wget docker nginx make cmake jq + +check-dependencies: + @missing=""; \ + for cmd in $(REQUIRED_COMMANDS); do \ + if ! command -v "$$cmd" >/dev/null 2>&1; then \ + missing="$$missing $$cmd"; \ + fi; \ + done; \ + if ! command -v docker-compose >/dev/null 2>&1 && ! docker compose version >/dev/null 2>&1; then \ + missing="$$missing docker-compose"; \ + fi; \ + if [ -n "$$missing" ]; then \ + echo " ! Missing required commands:$$missing"; \ + echo " ! Install them before running make install, for example:"; \ + echo " ! apt-get install -y curl wget docker.io docker-compose nginx make cmake jq"; \ + exit 1; \ + fi; \ + echo "-----> Required commands are installed" # mirrors setup-storage from debian/postinst so source installs leave the # data directory writable by the dokku user, which owns every deploy hook