name: Build and Deploy on: push: branches: - main pull_request: branches: - main jobs: build-push: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Build and push Docker image (OCI format for Zot registry) run: | # Download regctl for OCI-compatible push (Zot requires OCI format) curl -sL https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 \ -o /usr/local/bin/regctl && chmod +x /usr/local/bin/regctl docker build -t registry.storedbox.net/ollama-mcp:${{ github.sha }} . docker tag registry.storedbox.net/ollama-mcp:${{ github.sha }} \ registry.storedbox.net/ollama-mcp:latest docker save registry.storedbox.net/ollama-mcp:${{ github.sha }} \ -o /tmp/ollama-mcp.tar regctl image import registry.storedbox.net/ollama-mcp:${{ github.sha }} \ /tmp/ollama-mcp.tar regctl image copy \ registry.storedbox.net/ollama-mcp:${{ github.sha }} \ registry.storedbox.net/ollama-mcp:latest deploy: runs-on: ubuntu-latest needs: build-push if: github.ref == 'refs/heads/main' steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up kubectl uses: azure/setup-kubectl@v3 - name: Configure kubectl run: | echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig export KUBECONFIG=kubeconfig - name: Apply k8s manifests run: | kubectl apply -f k8s/deployment.yaml --kubeconfig=kubeconfig - name: Rollout restart to pull latest image run: | kubectl rollout restart deployment/ollama-mcp \ -n ai-inference --kubeconfig=kubeconfig kubectl rollout status deployment/ollama-mcp \ -n ai-inference --kubeconfig=kubeconfig --timeout=120s - name: Health check run: | sleep 10 MCP_IP=$(kubectl get svc ollama-mcp -n ai-inference \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}' \ --kubeconfig=kubeconfig) curl -f http://${MCP_IP}:8090/health || exit 1 echo "MCP server healthy at http://${MCP_IP}:8090"