-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.dev
43 lines (35 loc) · 1.05 KB
/
Makefile.dev
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
TM_AM_LOG_LEVEL ?= debug
IMAGE_NAME := amaas/amaas-grpc-ts-client-dev:latest
VERSION_LOCATION := './VERSION'
VERSION := $(shell cat $(VERSION_LOCATION))
# BSD sed does not support --version argument, use this to check if the sed is GNU or BSD one
ifeq ($(shell sed --version >/dev/null 2>&1; echo $$?),0)
SED := sed -i
else
SED := sed -i ''
endif
all: clean build
build:
cp ./protos/scan.proto scan.proto
$(SED) 's/__PACKAGE_VERSION__/$(VERSION)/' ./package.json
docker build \
-t $(IMAGE_NAME) \
--build-arg TM_AM_LOG_LEVEL=$(TM_AM_LOG_LEVEL) \
.
$(SED) 's/$(VERSION)/__PACKAGE_VERSION__/' ./package.json
mkdir -p output
docker run --rm $(IMAGE_NAME) tar -cz file-security-sdk-$(VERSION).tgz | tar xzf - -C output
test:
cp ./protos/scan.proto scan.proto
docker build \
--target unit_test \
-t $(IMAGE_NAME) \
--build-arg TM_AM_LOG_LEVEL=$(TM_AM_LOG_LEVEL) \
.
docker run --rm $(IMAGE_NAME) tar -cz coverage | tar xzf -
clean:
-@docker rmi -f $(IMAGE_NAME) || true
rm -f scan.proto
rm -rf output
rm -rf coverage
.PHONY: all build test clean