-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (37 loc) · 1.55 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
BINARY_NAME=agora-ui
VERSION?=latest
PKG_MANAGER?=dnf
.DEFAULT_GOAL := dist
dist: protobuf
@wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O ./bin/jq && chmod +x ./bin/jq
@./bin/jq 'to_entries | map_values({ (.key) : ("$$" + .key) }) | reduce .[] as $$item ({}; . + $$item)' ./src/config.json > ./src/config.tmp.json && mv ./src/config.tmp.json ./src/config.json
npm i && npm run build
images:
@podman build --no-cache --security-opt label=disable -t alvidir/$(BINARY_NAME):$(VERSION) -f ./container/$(BINARY_NAME)/containerfile .
push-images:
@podman push alvidir/$(BINARY_NAME):$(VERSION)
protobuf: install-deps
@protoc -I=. proto/*.proto \
--js_out=import_style=commonjs,binary:./src \
--plugin=./bin/protoc-gen-grpc-web \
--grpc-web_out=import_style=typescript,mode=grpcwebtext:./src
@sed -i '1s/^/\/* eslint-disable *\/\n/' ./src/proto/*
install-deps:
-$(PKG_MANAGER) install -y protobuf-compiler
@curl -LO https://github.com/grpc/grpc-web/releases/download/1.4.1/protoc-gen-grpc-web-1.4.1-linux-x86_64
@mkdir -p bin && mv --force ./protoc-gen-grpc-web-1.4.1-linux-x86_64 ./bin/protoc-gen-grpc-web
@chmod +x ./bin/protoc-gen-grpc-web
clean:
@rm -rf bin/
@rm -rf dist/
@rm -rf node_modules/
@rm -rf package-lock.json
@rm -rf config.tmp.json
@rm -rf src/proto
clean-images:
@podman image rm alvidir/$(BINARY_NAME):$(VERSION)
deploy:
podman run -p 8080:80 --name $(BINARY_NAME) --env-file .env localhost/alvidir/$(BINARY_NAME):$(VERSION)
undeploy:
podman stop $(BINARY_NAME)
podman rm -f $(BINARY_NAME)