-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
57 lines (42 loc) · 1.83 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#-----------------------------------------------------------------------------
# configuration - see also 'make help' for list of targets
#-----------------------------------------------------------------------------
# name of container
CONTAINER_NAME = swatto/promtotwilio
# name of instance and other options you want to pass to docker run for testing
INSTANCE_NAME = promtotwilio
RUN_OPTS = -p 9090:9090 --env-file ./.env
#-----------------------------------------------------------------------------
# default target
#-----------------------------------------------------------------------------
all : ## Build the container - this is the default action
all: build
#-----------------------------------------------------------------------------
# build container
#-----------------------------------------------------------------------------
build : ## build the container
docker build -t $(CONTAINER_NAME):latest .
clean : ## delete the image from docker
clean: stop
-docker rmi $(CONTAINER_NAME):latest
re : ## clean and rebuild
re: clean all
#-----------------------------------------------------------------------------
# test container
#-----------------------------------------------------------------------------
test : ## Run tests
test:
go test .
run : ## Run the container as a daemon locally for testing
run: build stop
docker run -it --rm --name=$(INSTANCE_NAME) $(RUN_OPTS) $(CONTAINER_NAME)
stop : ## Stop local test started by run
stop:
-docker stop $(INSTANCE_NAME)
-docker rm $(INSTANCE_NAME)
#-----------------------------------------------------------------------------
# supporting targets
#-----------------------------------------------------------------------------
help : ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
.PHONY : all build clean re run stop help