forked from lucacracco/phpqa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (34 loc) · 770 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
NAME = lucacracco/phpqa
## help : Print commands help.
.PHONY: help
ifneq (,$(wildcard docker.mk))
help : docker.mk
@sed -n 's/^##//p' $<
else
help : Makefile
@sed -n 's/^##//p' $<
endif
# If the first argument is "run"...
ifeq (run,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
## build : Build image.
.PHONY: build
build:
docker build -t $(NAME) ./
## push : Push image.
.PHONY: push
push:
docker push $(NAME)
## debug : Debug image.
.PHONY: debug
debug:
docker run --rm -it $(NAME) /bin/bash
## run : Run image.
.PHONY: run
run:
docker run --rm $(NAME) $(RUN_ARGS)
release: build push