feat: verify install dependencies before building
Fail fast and list the missing tools instead of surfacing unrelated errors later in the install; a missing nginx, for example, only failed once plugin:install --core ran. docker compose is accepted either as the standalone binary or as the docker compose plugin.
This commit is contained in:
26
Makefile
26
Makefile
@@ -31,7 +31,7 @@ else
|
|||||||
BUILD_STACK_TARGETS = build-in-docker
|
BUILD_STACK_TARGETS = build-in-docker
|
||||||
endif
|
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 docs.mk
|
||||||
include tests.mk
|
include tests.mk
|
||||||
@@ -42,7 +42,29 @@ include arch.mk
|
|||||||
all:
|
all:
|
||||||
# Type "make install" to install.
|
# 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
|
# mirrors setup-storage from debian/postinst so source installs leave the
|
||||||
# data directory writable by the dokku user, which owns every deploy hook
|
# data directory writable by the dokku user, which owns every deploy hook
|
||||||
|
|||||||
Reference in New Issue
Block a user