blob: 0f25c7783bfa5938bb0069cc298990032bdcda86 (
plain)
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
75
76
77
78
79
80
81
82
83
84
85
|
registry ?= localhost
app_name := canvas
environment := development
tag := $(shell git rev-parse --short HEAD)
image_name := $(registry)/$(app_name)
podman_socket := $(shell podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
# Build
default: dev
prepare:
@pnpm install
bundle: prepare
@pnpm exec vite build
build: bundle
@podman build -t $(image_name):$(tag) .
@podman tag $(image_name):$(tag) $(image_name):latest
ifneq ($(strip $(BRANCH)),)
@podman tag $(image_name):$(tag) $(image_name):$(shell echo $(BRANCH) | sed 's/\//-/g')
endif
upload: build login
@podman push $(image_name):$(tag)
@podman push $(image_name):latest
ifneq ($(strip $(BRANCH)),)
@podman push $(image_name):$(shell echo $(BRANCH) | sed 's/\//-/g')
endif
release: upload
@:
# Run
start:
@:
dev:
@podman-compose up --build
# Code Quality
lint: prepare
@pnpm exec eslint . --fix
format: lint
@pnpm exec prettier . --write
test: prepare
@pnpx tsx --experimental-test-coverage --test
ci: bundle test
@pnpm exec eslint .
@pnpm exec prettier . --check
# Auditing
sbom:
@trivy fs -q --format cyclonedx --scanners vuln,license --output extension-sbom.json extensions/lenislab
@trivy image -q --format cyclonedx --scanners vuln,license --output image-sbom.json --podman-host="$(podman_socket)" --image-src podman $(image_name):$(tag)
vulnerabilities: sbom
@echo "** Extension **"
@sbom-utility vulnerability list -q --input-file extension-sbom.json
@echo "** Image **"
@sbom-utility vulnerability list -q --input-file image-sbom.json
licenses: sbom
@echo "** Extension **"
@sbom-utility license list -q --input-file extension-sbom.json
@echo "** Image **"
@sbom-utility license list -q --input-file image-sbom.json
# Tools
generate_secret:
@openssl rand -base64 64 | tr -d '\n'
login:
@podman login "${registry}" -u nologin --password "${PASSWORD}"
.PHONY: default prepare build upload release start dev lint test ci generate_secret login format bundle
|