forked from TeslaGov/ngx-http-auth-jwt-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (56 loc) · 2.3 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
SHELL += -eu
BLUE := \033[0;34m
GREEN := \033[0;32m
RED := \033[0;31m
NC := \033[0m
DOCKER_ORG_NAME = teslagov
DOCKER_IMAGE_NAME = jwt-nginx
HOST_NGINX_PORT = 8080
.PHONY: all
all:
@$(MAKE) build-nginx
@$(MAKE) build-test-runner
@$(MAKE) start-nginx
@$(MAKE) test
.PHONY: build-nginx
build-nginx:
@echo "${BLUE} Building...${NC}"
@docker image build -t $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME) . ; \
if [ $$? -ne 0 ] ; \
then echo "${RED} Build failed :(${NC}" ; \
else echo "${GREEN}✓ Successfully built NGINX module ${NC}" ; fi
.PHONY: rebuild-nginx
rebuild-nginx:
@echo "${BLUE} Rebuilding...${NC}"
@docker image build -t $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME) . --no-cache ; \
if [ $$? -ne 0 ] ; \
then echo "${RED} Build failed :(${NC}" ; \
else echo "${GREEN}✓ Successfully rebuilt NGINX module ${NC}" ; fi
.PHONY: stop-nginx
stop-nginx:
docker stop $(shell docker inspect --format="{{.Id}}" "$(DOCKER_IMAGE_NAME)-cont") ||:
.PHONY: start1-nginx
start1-nginx:
docker run --rm --name "$(DOCKER_IMAGE_NAME)-cont" -d -p 172.31.24.55:8000:8000 $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
.PHONY: start-nginx
start-nginx:
docker run --rm --name "$(DOCKER_IMAGE_NAME)-cont" -d -p ${HOST_NGINX_PORT}:8000 $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/lib64/nginx/modules/ngx_http_auth_jwt_module.so .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjansson.so.4.13.0 .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.a .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.la .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.so.0.7.0 .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/pkgconfig/jansson.pc .
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/pkgconfig/libjwt.pc .
.PHONY: starti-nginx
starti-nginx:
docker run --rm -it --name "$(DOCKER_IMAGE_NAME)-cont" -p ${HOST_NGINX_PORT}:8000 $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
.PHONY: build-test-runner
build-test-runner:
docker image build -f Dockerfile-test -t $(DOCKER_ORG_NAME)/jwt-nginx-test-runner .
.PHONY: frebuild-test-runner
rebuild-test-runner:
docker image build -f Dockerfile-test -t $(DOCKER_ORG_NAME)/jwt-nginx-test-runner . --no-cache
.PHONY: test
test:
docker run --rm --add-host host.docker.internal:host-gateway $(DOCKER_ORG_NAME)/jwt-nginx-test-runner