-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
51 lines (38 loc) · 1.2 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
#Dockerfile vars
#vars
TAG=3.2.11p2
IMAGENAME=docker-ispconfig
IMAGEFULLNAME=avhost/${IMAGENAME}
BRANCH=${shell git symbolic-ref --short HEAD}
LASTCOMMIT=$(shell git log -1 --pretty=short | tail -n 1 | tr -d " " | tr -d "UPDATE:")
help:
@echo "Makefile arguments:"
@echo ""
@echo "Makefile commands:"
@echo "build"
@echo "publish-latest"
@echo "publish-tag"
.DEFAULT_GOAL := all
ifeq (${BRANCH}, master)
BRANCH=latest
endif
ifneq ($(shell echo $(LASTCOMMIT) | grep -E '^v([0-9]+\.){0,2}(\*|[0-9]+)'),)
BRANCH=${LASTCOMMIT}
else
BRANCH=latest
endif
build:
@echo ">>>> Build docker image: latest"
@docker build --build-arg TAG=${TAG} --build-arg BUILDDATE=${BUILDDATE} -t ${IMAGEFULLNAME}:latest .
push:
@echo ">>>> Publish docker image: " ${BRANCH}
@docker build --push --build-arg TAG=${TAG} --build-arg BUILDDATE=${BUILDDATE} -t ${IMAGEFULLNAME}:${BRANCH} .
@docker build --push --build-arg TAG=${TAG} --build-arg BUILDDATE=${BUILDDATE} -t ${IMAGEFULLNAME}:latest .
seccheck:
grype --add-cpes-if-none dir:.
imagecheck:
trivy image ${IMAGEFULLNAME}:${BRANCH}
sboom:
syft dir:. > sbom.txt
syft dir:. -o json > sbom.json
all: seccheck sboom build imagecheck