mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-19 03:41:40 +08:00
- 新增 MCP Server 的 Dockerfile、Compose 环境示例与 GHCR 镜像流水线\n- 补充 Podman Quadlet、Kubernetes Kustomize 与 Helm Chart 部署样例\n- 完善 MCP Server 独立 README,补充本地与远端 Agent 接入说明\n\nFixes #618
119 lines
3.8 KiB
YAML
119 lines
3.8 KiB
YAML
name: Docker Images
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
tags:
|
|
- 'v*'
|
|
|
|
concurrency:
|
|
group: docker-images-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
publish:
|
|
name: Publish ${{ matrix.image_name }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- image_name: gonavi-mcp-server
|
|
dockerfile: Dockerfile.mcp-server
|
|
description: GoNavi MCP Server container image
|
|
- image_name: gonavi-build-env
|
|
dockerfile: Dockerfile.build-env
|
|
description: GoNavi Linux build environment image
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Normalize image namespace
|
|
id: vars
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "owner_lc=$(printf '%s' "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ steps.vars.outputs.owner_lc }}/${{ matrix.image_name }}
|
|
flavor: |
|
|
latest=false
|
|
tags: |
|
|
type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
type=sha,format=short,prefix=dev-,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
labels: |
|
|
org.opencontainers.image.title=${{ matrix.image_name }}
|
|
org.opencontainers.image.description=${{ matrix.description }}
|
|
|
|
- name: Build smoke image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: linux/amd64
|
|
load: true
|
|
tags: codex-smoke/${{ matrix.image_name }}:local
|
|
cache-from: type=gha,scope=${{ matrix.image_name }}
|
|
|
|
- name: Smoke test MCP Server image
|
|
if: matrix.image_name == 'gonavi-mcp-server'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cid="$(docker run -d -p 8765:8765 -e GONAVI_MCP_HTTP_TOKEN=smoke-token codex-smoke/${{ matrix.image_name }}:local http)"
|
|
trap 'docker rm -f "$cid" >/dev/null 2>&1 || true' EXIT
|
|
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
if curl --fail --silent http://127.0.0.1:8765/healthz >/dev/null; then
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
docker logs "$cid"
|
|
echo "MCP Server image smoke test failed" >&2
|
|
exit 1
|
|
|
|
- name: Smoke test build environment image
|
|
if: matrix.image_name == 'gonavi-build-env'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
docker run --rm codex-smoke/${{ matrix.image_name }}:local \
|
|
bash -lc 'go version && node -v && npm -v && wails version'
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha,scope=${{ matrix.image_name }}
|
|
cache-to: type=gha,mode=max,scope=${{ matrix.image_name }}
|