- 复制 CAS 5.3.16 overlay 源码(src/、pom.xml、etc/cas/config/log4j2.xml、docker/cas.properties)及本地构建辅助(build.cmd/build.sh/maven-settings.xml) - build.yml:maven 产物由 jar 改为 war(cp cas.war app.jar),CI 内源码构建,摆脱 174MB war blob 入库 - Dockerfile:CAS 专用镜像(自签名 keystore 8443 HTTPS + 内置 cas.properties/log4j2.xml + JAVA_OPTS 注入) - pom.xml:移除 sonatype/shibboleth 外网仓库,依赖全部经 nexus maven-public 解析 - 前端 front/ 不入库(CasSsoFront 仓库独立发布)
This commit is contained in:
@@ -1,53 +1,16 @@
|
||||
# CasService
|
||||
|
||||
> 本仓库由 projman 自动创建并注入 CI(`.gitea/workflows/build.yml`)与 Dockerfile(`docker/Dockerfile`)。
|
||||
> 推送代码到 main 分支即自动构建镜像并推送到 Nexus,projman 收到通知后建档待部署,由运维在 projman「后端发布」手动点部署。
|
||||
CAS 5.3.16 单点登录服务(war overlay 项目,源自 CasSsoService 改版迁移)。本仓库由 projman 创建并注入 CI 与 Dockerfile,已按 CAS 项目形态适配。
|
||||
|
||||
## 首次推送本地代码到本仓库
|
||||
## 与标准 springboot CI 模板的差异
|
||||
|
||||
> 目标:把本地已有代码推上去,同时**保留** projman 注入的文件(`build.yml`、`Dockerfile`)。
|
||||
|
||||
```bash
|
||||
# 1. 进入本地代码目录
|
||||
cd /your/local/code/dir
|
||||
|
||||
# 2. 初始化 git(目录已有 .git 也安全,git init 幂等无副作用)
|
||||
git init
|
||||
git branch -M main
|
||||
|
||||
# 3. 先把本地代码提交成一个 commit(关键!不提交直接 merge 会丢失本地代码)
|
||||
git add -A
|
||||
git commit -m "init local code"
|
||||
|
||||
# 4. 关联远程仓库(幂等:已存在 origin 则改地址,不报错)
|
||||
git remote add origin http://gitea.yunhaixingtong.com/cas/CasService.git 2>/dev/null \
|
||||
|| git remote set-url origin http://gitea.yunhaixingtong.com/cas/CasService.git
|
||||
|
||||
# 5. 拉取远程信息(只下载,不合并)
|
||||
git fetch origin
|
||||
|
||||
# 6. 合并远程 main(关键步骤)
|
||||
# 本地与远程是两条独立历史,需允许合并不相关历史。
|
||||
# 此步会把 projman 注入的 build.yml 与 Dockerfile 合并进你的本地工作区。
|
||||
git merge origin/main --allow-unrelated-histories -m "merge projman injected files"
|
||||
|
||||
# 7. 查看状态(确认 .gitea/workflows/build.yml、docker/Dockerfile 已在本地)
|
||||
git status
|
||||
|
||||
# 8. 提交并推送
|
||||
git add -A
|
||||
git commit -m "sync local code" 2>/dev/null || true
|
||||
git push origin main
|
||||
```
|
||||
- **构建产物是 WAR 不是 jar**:pom `packaging=war`、`finalName=cas`,CI 在 maven 构建后 `cp cas.war app.jar`(可执行 WAR,WarLauncher 直接 `java -jar`)。
|
||||
- **Dockerfile 为 CAS 专用**:镜像内生成自签名 keystore(8443 HTTPS),内置 `docker/cas.properties`(仅 TLS/端口/日志)与 `etc/cas/config/log4j2.xml`;业务配置由 projman 配置管理挂载 `/app/config/application.yml`。
|
||||
- **健康检查**:`/cas/status`(HTTPS 自签名),projman 应用需配置 healthPath=`/cas/status` + HTTPS 开。
|
||||
- **pom 不声明外网仓库**:依赖全部经 nexus maven-public 代理解析(内网 CI 无外网)。
|
||||
- 前端登录页静态文件由 CasSsoFront 仓库独立发布(`src/main/webapp/front/` 不入库)。
|
||||
|
||||
## 推送后验证
|
||||
|
||||
push 触发 CI 构建,前往 Gitea 仓库 → **Actions** 查看日志;构建成功后镜像推送到 Nexus,projman 建档待部署,在 projman 应用详情「后端发布」手动点部署。
|
||||
push 到 main 触发 CI 构建,前往 Gitea 仓库 → **Actions** 查看日志;构建成功后镜像推送到 Nexus(`docker-hosted/cas-service:{sha8}`),projman 建档待部署,在 projman 应用详情「后端发布」手动点部署。
|
||||
|
||||
## 禁止写法(会导致注入文件被删)
|
||||
|
||||
`git reset origin/main` + `git add -A` 会把远程已注入、但你本地没有的文件(`build.yml`、`Dockerfile`)当作"删除"提交并推送,导致这些文件被删、CI 失败。务必用 `git merge` 而非 `git reset`,且 merge 前先提交本地代码。
|
||||
|
||||
## 关于 Dockerfile
|
||||
|
||||
projman 注入的 Dockerfile 仅在仓库不存在时写入;你自备的 Dockerfile 优先,不会被覆盖。
|
||||
|
||||
Reference in New Issue
Block a user