feat(M0): 工程骨架 — Go 后端 + Vue3 前端脚手架

- Go 工程:cmd/usernode CLI(serve/migrate/admin create/reset-password/user otp)
  + internal/{config,model,service,system,auth,cron,api,router,server,pkg,webui}
- 配置:TOML + 环境变量覆盖(USERNODE_<SEC>_<FIELD>),config.example.toml
- 数据:GORM 双驱动(SQLite/MySQL)8 表模型,migrate 子命令可跑通
- 系统层:system.Manager 接口(useradd/userdel/passwd 白名单,dev dry-run)
- HTTP:Gin 路由骨架(/api/v1 + 501 占位),healthz,slog 结构化日志,优雅启停
- 前端:Vite + Vue3 + TS + Element Plus 最小可运行(web/),go:embed 打通
- 构建:deploy/Containerfile 多阶段单二进制镜像,web/Containerfile.dev 前端 dev
  镜像,Makefile(build/test/dev/web-build/image);go.mod 锁定 go 1.22
- 验证:go build/vet/test 通过;podman 镜像构建运行 healthz+embed 通过
This commit is contained in:
2026-08-29 22:43:27 +08:00
parent f70b344c85
commit ae45aba607
46 changed files with 2878 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# 前端开发镜像(podman 热开发)
#
# 构建(走代理时):
# podman build -t ws-usernode-web-dev \
# --build-arg HTTP_PROXY=http://10.62.25.123:7897 \
# --build-arg HTTPS_PROXY=http://10.62.25.123:7897 \
# --build-arg ALL_PROXY=http://10.62.25.123:7897 \
# -f web/Containerfile.dev web/
#
# 运行:
# podman run --rm -p 5173:5173 \
# -v $PWD/web:/app -v web_node_modules:/app/node_modules \
# -e VITE_API_PROXY=http://host.containers.internal:8080 \
# ws-usernode-web-dev
#
# 说明:-v 挂载源码热更新;named volume 缓存 node_modules 避免每次重装。
# 容器内无 proxychains,代理须经 --build-arg 传入。
FROM node:20-alpine
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG ALL_PROXY=
ARG NO_PROXY=
ENV HTTP_PROXY=$HTTP_PROXY \
HTTPS_PROXY=$HTTPS_PROXY \
ALL_PROXY=$ALL_PROXY \
NO_PROXY=$NO_PROXY
WORKDIR /app
# 先复制依赖清单,利用层缓存
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev"]