forked from 869413421/chatgpt-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (33 loc) · 1.58 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
NAMESPACE := apps
MAIN_PKG := chatgpt-web
DOCKER_HUB := ccr.ccs.tencentyun.com/fastapp
GIT_TAG := $(shell git describe --abbrev=0 --tags 2>/dev/null || echo 0.0.0)
GIT_TAG := v1.0.0
GIT_COMMIT_SEQ := $(shell git rev-parse --short HEAD 2>/dev/null || echo 000000)
GIT_COMMIT_CNT := $(shell git rev-list --all --count 2>/dev/null || echo 0)
VERSION := $(GIT_TAG).$(GIT_COMMIT_CNT).$(GIT_COMMIT_SEQ)
BUILD_TIME := $(shell TZ=UTC-8 date +"%Y%m%d%H%M%S")
FULL_VERSION := $(MAIN_PKG):$(GIT_TAG).$(GIT_COMMIT_CNT).$(GIT_COMMIT_SEQ)
mod:
go mod tidy; go mod vendor
build:
go build -tags=jsoniter -mod=vendor -ldflags "-s -w -X 'chatgpt-web/config.BuildVersion=$(FULL_VERSION)' -X 'chatgpt-web/config.BuildTime=$(BUILD_TIME)'" -o $(MAIN_PKG)
frontend:
cd chat-new && cnpm install --registry=https://registry.npm.taobao.org && cnpm run build && rm -rf ../dist && mv -f dist ../
docker-login:
docker login ccr.ccs.tencentyun.com --username=100001261741 --password=ccr15652936798
docker:
docker build . -t $(DOCKER_HUB)/$(FULL_VERSION)
docker-save: docker
docker save $(DOCKER_HUB)/$(FULL_VERSION) | gzip > $(FULL_VERSION).tar.gz
docker-push:
docker push $(DOCKER_HUB)/$(FULL_VERSION)
docker-clean:
docker images | grep $(MAIN_PKG) | awk '{print $$3}' | xargs docker rmi -f
echo "y" | docker image prune
version:
echo $(DOCKER_HUB)/$(FULL_VERSION)
deploy: docker docker-push
kubectl --kubeconfig .k3s.yaml config set-context --current --namespace $(NAMESPACE)
kubectl --kubeconfig .k3s.yaml set image deployment $(MAIN_PKG) $(MAIN_PKG)=ccr.ccs.tencentyun.com/fastapp/$(FULL_VERSION)
.PHONY: build frontend