-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
43 lines (37 loc) · 970 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
42
43
ifneq (,)
This makefile requires GNU Make.
endif
PROJECT:=dockup
VERSION?=latest
OWNER:=tareksamni
DOCKER_IMAGE?=$(OWNER)/$(PROJECT):$(VERSION)
DOCKER:=$(shell which docker)
# target: help - display this help.
.PHONY: help
help:
@egrep '^# target' [Mm]akefile
# target: build-docker
.PHONY: build-docker
build-docker: Dockerfile
$(DOCKER) build --pull -t $(DOCKER_IMAGE) .
# target: push-docker
.PHONY: push-docker
push-docker:
$(DOCKER) push $(DOCKER_IMAGE)
# target: run-docker
.PHONY: run-docker
run-docker: build-docker
$(DOCKER) push $(DOCKER_IMAGE)
$(DOCKER) run \
--env-file test.env \
--env CODECLIMATE_REPO_TOKEN=$(CODECLIMATE_REPO_TOKEN) \
$(DOCKER_IMAGE)
# target: test-docker
.PHONY: test-docker
test-docker: build-docker
$(DOCKER) push $(DOCKER_IMAGE)
$(DOCKER) run \
--env-file test.env \
--env CODECLIMATE_REPO_TOKEN=$(CODECLIMATE_REPO_TOKEN) \
$(DOCKER_IMAGE) \
/bin/bash -c "bundle exec rspec; bundle exec codeclimate-test-reporter"