-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (26 loc) · 768 Bytes
/
Makefile
File metadata and controls
35 lines (26 loc) · 768 Bytes
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
.PHONY: all build test unit-tests bats rm-image clean
REPO_OWNER := koding
REPO_NAME := base
IMAGE_TAG := $(shell git describe --exact-match 2>/dev/null || echo latest)
IMAGE_NAME := $(REPO_OWNER)/$(REPO_NAME):$(IMAGE_TAG)
all: test
build:
@echo "+ $@"
docker build --no-cache --tag $(IMAGE_NAME) $(CURDIR)
test: build unit-tests
unit-tests: bats clean
@echo "+ $@"
@LC_ALL=C $(TMPDIR)/bin/bats --tap tests
bats:
@echo "+ Downloading $@"
$(eval TMPDIR := $(shell mktemp -d /tmp/bats.XXXXXXXX))
git clone https://github.com/sstephenson/bats.git $(TMPDIR)
@echo "> Downloaded into $(TMPDIR)"
rm-image:
ifneq ($(shell docker images --quiet $(IMAGE_NAME)),)
@echo "+ $@"
docker rmi --force $(IMAGE_NAME)
endif
clean:
@echo "+ $@"
$(RM) -r /tmp/bats.*