38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
name: deploy-cassso-service
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-latest
|
|
# docker:24 自带 docker CLI;宿主 docker.sock 默认挂入 job 容器。
|
|
container:
|
|
image: docker:24
|
|
steps:
|
|
- name: Install git (alpine)
|
|
run: apk add --no-cache git
|
|
|
|
- name: Checkout (manual, internal Gitea)
|
|
# cas.war (174MB) 已作为普通 blob 入库(服务端未启用 LFS)
|
|
run: |
|
|
git clone --depth 1 --branch main http://192.168.10.160:3000/${GITHUB_REPOSITORY}.git /tmp/src
|
|
cp -a /tmp/src/. .
|
|
rm -rf .git .gitea
|
|
rm -rf /tmp/src
|
|
|
|
- name: Build image (copies docker/cas.war) on host daemon
|
|
# 经由挂载的 docker.sock 在宿主守护进程上构建,镜像直接落在宿主本地
|
|
run: docker build -f docker/Dockerfile -t cassso-service:latest .
|
|
|
|
- name: Deploy on host (infra-infra-net, CAS 端口 8443)
|
|
# 镜像已在宿主本地,直接运行,无需推送到 nexus(nexus docker 仓库为 HTTP,需 daemon insecure-registries 才能推送)
|
|
run: |
|
|
docker rm -f cas-sso 2>/dev/null || true
|
|
docker run -d --name cas-sso --network infra-infra-net -p 8443:8443 --restart unless-stopped cassso-service:latest
|
|
|
|
- name: Done
|
|
run: 'echo "CasSsoService deployed -> https://192.168.10.160:8443/login"'
|