-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
46 lines (37 loc) · 1.31 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
keys_path = test-image/nginx/keys
test/keys:
@mkdir -p $(keys_path)
@openssl genrsa 2048 > $(keys_path)/rsa-private.pem
@openssl genrsa 2048 > $(keys_path)/rsa-wrong-private.pem
@openssl rsa -in $(keys_path)/rsa-private.pem -pubout > $(keys_path)/rsa-public.pem
@openssl rsa -in $(keys_path)/rsa-wrong-private.pem -pubout > $(keys_path)/rsa-wrong-public.pem
# Tests with an existing container
# usage: make test/current container=my-test-container
# same as ./test.sh --current my-test-container
# example:
# terminal 1: docker run --rm --name my-test-container -p 8000:8000 jwt-nginx-test
# terminal 2: make test/current container=my-test-container
test/current:
@bash test.sh --current $(container)
# Tests with a given image
# usage: make test/image image=my-test-image
# same as ./test.sh your-image-to-test
test/image:
@bash test.sh $(image)
# Used by Github workflow
test/local:
@bash test.sh --local
# Run tests in container
test/docker:
@cat Dockerfile Dockerfile.test > Dockerfile.merged
@docker build -f Dockerfile.merged .
# Build test image
test-image: build test-image/*
@cd test-image && docker build -f Dockerfile -t jwt-nginx-test .
# Build test image & run test suite
test: test/keys build
@bash test.sh
build:
@docker build --progress plain -f Dockerfile -t jwt-nginx .
clear:
@rm -r $(keys_path)