Files
iotlcm/Makefile
T
MiFaZhan f7cab5ad5c
mirror-to-gitee / mirror (push) Successful in 14s
chore: 整合为单仓 iotlcm(12 个仓 → 1 个仓)
把原来 12 个独立仓合并为单仓多服务结构,各仓完整提交历史通过
read-tree 并入保留(137 个提交,blame 可追溯)。

目录:
  admin-svr/ admin-ui/ app/{server,app}/ openapi/ worker-svr/
  upstream-chan/ upstream-proxy/ sms/ bot/ docs/ onelink-mock/ deploy/

同时:
- 新增根 README(目录说明、快速开始、源码构建、镜像发布、许可)
- 新增根 Makefile(make build / test / images / docs)
- 新增根 .gitattributes / .gitignore,删掉 12 份重复的 Apache LICENSE
  (admin-ui/ 与 app/app/ 的 MIT 上游许可保留)
- 各服务的 .gitea/workflows 收敛到仓根:trigger-jenkins.yml(tag 构建全部
  服务)+ mirror-to-gitee.yml(自动建 Gitee 仓后镜像)
- 文档内跨仓绝对链接改为仓内相对路径;部署/构建文档改为单仓路径
2026-11-02 13:35:58 +08:00

71 lines
2.5 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# iotLCM 开源版 —— 常用构建入口
#
# make build 编译全部 Go 服务
# make test 跑全部 Go 模块的单元测试
# make images 本地构建全部镜像(默认 tag 用 git describe)
# make docs 本地构建文档站
# make clean 清理构建产物
#
# 镜像仓库与版本可覆盖:
# make images REGISTRY=registry.example.com/iotlcm/iotlcm VERSION=v1.0.4
REGISTRY ?= iotlcm
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD)
BASE_REGISTRY ?= docker.io/library
GO_MODULES := admin-svr/server app/server bot onelink-mock openapi sms upstream-chan upstream-proxy worker-svr
# 目录|镜像名|构建上下文|Dockerfile
IMAGE_MAP := \
admin-svr|iotlcm-admin-svr|admin-svr/server|build/Dockerfile \
admin-ui|iotlcm-admin-ui|admin-ui|vue/build/Dockerfile \
openapi|iotlcm-openapi|openapi|build/Dockerfile \
worker-svr|iotlcm-worker-svr|worker-svr|build/Dockerfile \
upstream-chan|iotlcm-upstream-chan|upstream-chan|build/Dockerfile \
upstream-proxy|iotlcm-upstream-proxy|upstream-proxy|build/Dockerfile \
app|iotlcm-app-server|app/server|Dockerfile \
app|iotlcm-app-web|app/app|Dockerfile \
sms|iotlcm-sms|sms|build/Dockerfile \
bot|iotlcm-bot|bot|Dockerfile \
docs|iotlcm-docs|docs|Dockerfile \
onelink-mock|iotlcm-onelink-mock|onelink-mock|Dockerfile
.PHONY: help build test images docs clean
help:
@sed -n '2,12p' Makefile | sed 's/^# \{0,1\}//'
build:
@set -e; for m in $(GO_MODULES); do \
echo "==> go build ./... ($$m)"; \
( cd "$$m" && go build ./... ); \
done
@echo "✅ 全部 Go 服务编译通过"
test:
@set -e; for m in $(GO_MODULES); do \
echo "==> go test ./... ($$m)"; \
( cd "$$m" && go test ./... ); \
done
images:
@set -e; echo "镜像前缀: $(REGISTRY) 版本: $(VERSION)"; \
echo "$(IMAGE_MAP)" | tr ' ' '\n' | while IFS='|' read -r dir img ctx df; do \
[ -z "$$dir" ] && continue; \
echo ""; echo "==> $$img:$$VERSION (context=$$ctx dockerfile=$$df)"; \
docker build -f "$$ctx/$$df" \
--build-arg BASE_REGISTRY="$(BASE_REGISTRY)" \
--build-arg BuildVersion="$(VERSION)" \
--build-arg CommitID="$$(git rev-parse --short=7 HEAD)" \
--build-arg BuildTime="$$(date -u +%FT%TZ)" \
-t "$(REGISTRY):$$img-$(VERSION)" "$$ctx"; \
done
docs:
cd docs && npm ci && npm run build
@echo "✅ 文档站产物:docs/.vitepress/dist"
clean:
@rm -rf docs/.vitepress/dist docs/.vitepress/cache
@echo "✅ 已清理"