Skip to content

Commit

Permalink
Check if docker is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellem committed May 3, 2024
1 parent 901a811 commit 75c606c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
17 changes: 16 additions & 1 deletion hacking/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
VERBOSE ?= 0
COMPOSE_FILE ?= compose.yml
DOCKER_MISSING := $(shell ./scripts/check-docker.sh)
DOCKER_VERSION := $(shell docker -v)

.DEFAULT_GOAL := help

##@
##@ Local network management commands
##@
start: ##@ Start local network
ifeq ($(DOCKER_MISSING),1)
$(error Docker is not installed. Please install docker before proceeding. See https://docs.docker.com/engine/install/)
endif
ifeq ($(VERBOSE),0)
./scripts/start_node.sh
else
./scripts/start_node.sh -v
endif

stop: ##@ Stop local network
ifeq ($(DOCKER_MISSING),1)
$(error Docker is not installed. Please install docker before proceeding. See https://docs.docker.com/engine/install/)
endif
docker compose --file $(COMPOSE_FILE) down --volumes --remove-orphans


Expand Down Expand Up @@ -51,10 +59,17 @@ help: ##@ (Default) Print listing of key targets with their descriptions
printf " \033[34m%-27s\033[0m %s\n", $$1, $$2; \
}'

build: ## Build docker image used to run the local network and the attacks
build: check ## Build docker image used to run the local network and the attacks
## Only supported for the development mode with COMPOSE_FILE=dev.yml
docker compose --file $(COMPOSE_FILE) build

check-docker: ##@ Check if docker is installed
ifeq ($(DOCKER_MISSING),1)
$(error Docker is not installed. Please install docker before proceeding. See https://docs.docker.com/engine/install/)
else
@echo $(DOCKER_VERSION)
endif

clean:
-rm -rf \
adv_key \
Expand Down
8 changes: 8 additions & 0 deletions hacking/scripts/check-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ -x "$(command -v docker)" ];
then
echo 0
else
echo 1
fi

0 comments on commit 75c606c

Please sign in to comment.