-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (50 loc) · 1.7 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
#Dockerfile vars
#vars
TAG=dev
UID=`id -u`
GID=`id -g`
TAG=${shell git describe}
BUILDDATE=${shell date -u +%Y-%m-%dT%H:%M:%SZ}
IMAGENAME=mesos-firecracker-executor
IMAGEFULLNAME=avhost/${IMAGENAME}
BRANCH=`git symbolic-ref --short HEAD`
LASTCOMMIT=$(shell git log -1 --pretty=short | tail -n 1 | tr -d " " | tr -d "UPDATE:")
.PHONY: help build all docs
.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-bin:
@echo ">>>> Build binary"
@CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w -X main.BuildVersion=${BUILDDATE} -X main.GitVersion=${TAG} -extldflags \"-static\"" -o build/mesos-firecracker-executor .
build: build-bin
@echo ">>>> Build docker image branch: latest"
@docker build -t avhost/mesos-firecracker-executor:latest -f Dockerfile .
submodule-update:
@git pull --recurse-submodules
@git submodule update --recursive --remote
build-vmm:
@cd resources/vmm-agent/; ${MAKE}
@cp resources/vmm-agent/build/vmm-agent build/
@cp resources/vmm-agent/build/vmlinux build/
seccheck:
grype --add-cpes-if-none .
sboom:
syft dir:. > sbom.txt
syft dir:. -o json > sbom.json
go-fmt:
@gofmt -w .
update-gomod:
go get -u
push:
@echo ">>>> Publish docker image: " ${BRANCH}
@docker buildx build --platform linux/amd64 --push --build-arg TAG=${TAG} --build-arg BUILDDATE=${BUILDDATE} -t ${IMAGEFULLNAME}:latest .
@docker buildx build --platform linux/amd64 --push --build-arg TAG=${TAG} --build-arg BUILDDATE=${BUILDDATE} -t ${IMAGEFULLNAME}:${BRANCH} .
check: go-fmt sboom seccheck
all: submodule-update check build-vmm build
vmm: build-vmm