Skip to content

Commit d222b47

Browse files
authored
Makefile: docker-serve target: ensure Docker is installed (#608)
1 parent b33336b commit d222b47

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ JEKYLL=bundle config set --local path .vendor/bundle && bundle install && bundle
77
PARSER=bin/markdown_ast.rb
88
DST=_site
99

10+
# Find Docker
11+
DOCKER := $(shell which docker 2>/dev/null)
12+
1013
# Check Python 3 is installed and determine if it's called via python3 or python
1114
# (https://stackoverflow.com/a/4933395)
1215
PYTHON3_EXE := $(shell which python3 2>/dev/null)
@@ -50,14 +53,18 @@ site : lesson-md index.md
5053

5154
## * docker-serve : use Docker to serve the site
5255
docker-serve :
53-
@docker pull carpentries/lesson-docker:latest
54-
@docker run --rm -it \
56+
ifeq (, $(DOCKER))
57+
$(error Your system does not appear to have Docker installed)
58+
else
59+
@$(DOCKER) pull carpentries/lesson-docker:latest
60+
@$(DOCKER) run --rm -it \
5561
-v $${PWD}:/home/rstudio \
5662
-p 4000:4000 \
5763
-p 8787:8787 \
5864
-e USERID=$$(id -u) \
5965
-e GROUPID=$$(id -g) \
6066
carpentries/lesson-docker:latest
67+
endif
6168

6269
## * repo-check : check repository settings
6370
repo-check : python

0 commit comments

Comments
 (0)