-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
37 lines (30 loc) · 1.27 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
#------------------------------------------------------------------
# Project build information
#------------------------------------------------------------------
PROJNAME := kubernetes-toolkit
KUBERNETES_VERSION := 1.31.0
GCR_REPO := eu.gcr.io/swade1987
GCLOUD_SERVICE_KEY ?="unknown"
GCLOUD_SERVICE_EMAIL := [email protected]
GOOGLE_PROJECT_ID := swade1987
GOOGLE_COMPUTE_ZONE := europe-west2-a
CIRCLE_BUILD_NUM ?="unknown"
IMAGE := $(PROJNAME):$(KUBERNETES_VERSION)
#------------------------------------------------------------------
# CI targets
#------------------------------------------------------------------
build:
docker build \
--build-arg KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
-t $(IMAGE) .
push-to-gcr: configure-gcloud-cli
docker tag $(IMAGE) $(GCR_REPO)/$(IMAGE)
gcloud docker -- push $(GCR_REPO)/$(IMAGE)
docker rmi $(GCR_REPO)/$(IMAGE)
configure-gcloud-cli:
echo '$(GCLOUD_SERVICE_KEY)' | base64 --decode > /tmp/gcloud-service-key.json
gcloud auth activate-service-account $(GCLOUD_SERVICE_EMAIL) --key-file=/tmp/gcloud-service-key.json
gcloud --quiet config set project $(GOOGLE_PROJECT_ID)
gcloud --quiet config set compute/zone $(GOOGLE_COMPUTE_ZONE)
scan: build
trivy --light -s "UNKNOWN,MEDIUM,HIGH,CRITICAL" --exit-code 1 $(IMAGE)