-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (58 loc) · 2.74 KB
/
Copy pathMakefile
File metadata and controls
74 lines (58 loc) · 2.74 KB
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
72
73
74
# global service name
SERVICE := open-termhub
INTERACTIVE := $(shell [ -t 0 ] && echo 1)
#######################################################################
# OVERRIDE THIS TO MATCH YOUR PROJECT #
#######################################################################
# Most applications have their own method of maintaining a version number.
APP_VERSION := $(shell echo `grep "version = " build.gradle | cut -d\= -f 2`)
DOCKER_INT_REGISTRY := wcinformatics
.PHONY: build
clean: ## Clean build artifacts. Override for your project
./gradlew clean
build: clean ## Build the library without tests
./gradlew bootJar -x test -x spotbugsMain -x spotbugsTest -x javadoc
scan: ## scan for vulnerabilities in dependencies
/bin/rm -rf gradle/dependency-locks
./gradlew dependencies --write-locks --configuration runtimeClasspath
trivy fs gradle.lockfile --format template -o report.html --template "@config/trivy/html.tpl"
grep CRITICAL report.html
/bin/rm -rf gradle.lockfile
fullscan: ## scan for vulnerabilities in dependencies
/bin/rm -rf gradle/dependency-locks
./gradlew dependencies --write-locks
trivy fs gradle.lockfile --format template -o report.html --template "@config/trivy/html.tpl"
grep CRITICAL report.html
/bin/rm -rf gradle.lockfile
test: clean ## Run all tests
./gradlew test spotbugsMain spotbugsTest
test-r4: clean ## Run R4 tests only
./gradlew testR4
test-r5: clean ## Run R5 tests only
./gradlew testR5
run: ## Run the server
./run.sh
# connect
rundebug: ## Run the server with debug logging and JVM debug port (5005)
./gradlew bootRun --debug-jvm -DLOG_LEVEL=debug
docker:
# Remove prior docker image if it is built
ifdef DOCKER_IMG
docker rmi -f $(DOCKER_IMG)
else
@echo No docker image to remove
endif
@echo SERVICE=$(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION)
docker build --platform linux/amd64 --build-arg APP_VERSION=$(APP_VERSION) --no-cache-filter=gradle-build -t $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION) .
docker tag $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION) $(DOCKER_INT_REGISTRY)/$(SERVICE):latest
scandocker:
docker save -o scan.tar $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION)
trivy image --input scan.tar $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION) --format template -o report.html --template "@config/trivy/html.tpl"
egrep "CRITICAL|HIGH" report.html
/bin/rm -f scan.tar
release: ## publish to dockerhub
@echo $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION)
docker -D push --platform linux/amd64 $(DOCKER_INT_REGISTRY)/$(SERVICE):latest
docker -D push --platform linux/amd64 $(DOCKER_INT_REGISTRY)/$(SERVICE):$(APP_VERSION)
version:
@echo $(APP_VERSION)