Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6347e4b211 | ||
|
|
83dea1f728 | ||
|
|
060ac0820a | ||
|
|
0d2b6f6067 | ||
|
|
a5a1de354a | ||
|
|
6deb1c2462 | ||
|
|
f8039e5007 | ||
|
|
f3772c45cd | ||
|
|
68229414a3 | ||
|
|
fc60f7f268 | ||
|
|
7c3f3c5acc | ||
|
|
c068487103 | ||
|
|
21bde6f57d | ||
|
|
1eb921f277 | ||
|
|
02eaf3606b | ||
|
|
4a936b03d6 | ||
|
|
604c7cc0d5 | ||
|
|
aa867e2949 | ||
|
|
820ea95f26 |
@@ -0,0 +1,100 @@
|
|||||||
|
name: Build & Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
[workflow_dispatch, push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.aggtaa.com
|
||||||
|
# IMAGE_PREFIX: ${{ gitea.repository }} # set by a step
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ── BUILD SERVER ──────────────────────────────────────────────────────────────
|
||||||
|
build-app:
|
||||||
|
runs-on: docker1
|
||||||
|
outputs:
|
||||||
|
IMAGE_PREFIX: ${{ steps.prefix.outputs.IMAGE_PREFIX }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: sh
|
||||||
|
working-directory: /workspace
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
working-directory: /
|
||||||
|
run: |
|
||||||
|
mkdir -p /workspace
|
||||||
|
cd /workspace
|
||||||
|
|
||||||
|
if [ -d .git ]; then
|
||||||
|
git remote set-url origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
|
||||||
|
else
|
||||||
|
git init
|
||||||
|
git remote add origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch --prune origin ${{ gitea.ref_name }}
|
||||||
|
git checkout -f FETCH_HEAD
|
||||||
|
git reset --hard FETCH_HEAD
|
||||||
|
git clean -fdx
|
||||||
|
|
||||||
|
- name: Set lowercase image prefix
|
||||||
|
id: prefix
|
||||||
|
run: echo "IMAGE_PREFIX=$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build & push app
|
||||||
|
run: |
|
||||||
|
cd /workspace
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||||
|
docker login ${{ env.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
|
||||||
|
|
||||||
|
/data/tools/docker-buildx build \
|
||||||
|
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ steps.prefix.outputs.IMAGE_PREFIX }}/app:cache \
|
||||||
|
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ steps.prefix.outputs.IMAGE_PREFIX }}/app:cache,mode=max \
|
||||||
|
--tag ${{ env.REGISTRY }}/${{ steps.prefix.outputs.IMAGE_PREFIX }}/app:latest \
|
||||||
|
--tag ${{ env.REGISTRY }}/${{ steps.prefix.outputs.IMAGE_PREFIX }}/app:${{ gitea.sha }} \
|
||||||
|
--file Dockerfile \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
|
||||||
|
# ── DEPLOY ────────────────────────────────────────────────────────────────────
|
||||||
|
deploy:
|
||||||
|
runs-on: docker1
|
||||||
|
needs: [build-app]
|
||||||
|
if: always() && !failure() && !cancelled()
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: sh
|
||||||
|
steps:
|
||||||
|
- name: Debug environment
|
||||||
|
run: |
|
||||||
|
hostname
|
||||||
|
cat /etc/hostname
|
||||||
|
docker --version
|
||||||
|
docker compose version || echo "compose plugin missing here"
|
||||||
|
ls /usr/libexec/docker/cli-plugins/ 2>/dev/null || echo "no plugins dir"
|
||||||
|
mount | grep docker || true
|
||||||
|
- name: Debug repo contents
|
||||||
|
run: |
|
||||||
|
cd "/app-cache/${{ gitea.repository }}"
|
||||||
|
ls -la
|
||||||
|
- name: Deploy
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||||
|
docker login ${{ env.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
|
||||||
|
|
||||||
|
mkdir -p "/app-cache/${{ gitea.repository }}"
|
||||||
|
cd "/app-cache/${{ gitea.repository }}"
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
|
||||||
|
fi
|
||||||
|
git fetch --prune origin ${{ gitea.ref_name }}
|
||||||
|
git checkout -f FETCH_HEAD
|
||||||
|
git reset --hard FETCH_HEAD
|
||||||
|
git clean -fdx
|
||||||
|
printf 'REGISTRY=%s\nIMAGE_PREFIX=%s\nIMAGE_TAG=%s\nSERVICE_NAME=%s\n' \
|
||||||
|
'${{ env.REGISTRY }}' \
|
||||||
|
'${{ needs.build-app.outputs.IMAGE_PREFIX }}' \
|
||||||
|
'${{ gitea.sha }}' \
|
||||||
|
"$(basename '${{ needs.build-app.outputs.IMAGE_PREFIX }}')" > .env
|
||||||
|
/data/tools/docker-compose pull
|
||||||
|
/data/tools/docker-compose up -d --remove-orphans
|
||||||
|
docker image prune -f
|
||||||
@@ -1 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
dist
|
||||||
|
.env
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM node:22.22.3-alpine AS base
|
||||||
|
RUN corepack enable && corepack prepare pnpm@11 --activate
|
||||||
|
|
||||||
|
# ── deps ──────────────────────────────────────────────────────────────────────
|
||||||
|
FROM base AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# ── build ─────────────────────────────────────────────────────────────────────
|
||||||
|
FROM deps AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY tsconfig.json ./
|
||||||
|
COPY src ./src
|
||||||
|
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
|
# ── runtime ───────────────────────────────────────────────────────────────────
|
||||||
|
FROM node:22.22.3-alpine AS runner
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile --prod
|
||||||
|
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["node", "dist/index.js"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
server:
|
||||||
|
image: ${REGISTRY}/${IMAGE_PREFIX}/app:latest
|
||||||
|
container_name: ${SERVICE_NAME}
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${APP_PORT:-3000}:3000"
|
||||||
|
networks:
|
||||||
|
- local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
local:
|
||||||
|
driver: bridge
|
||||||
+2
-7
@@ -14,14 +14,9 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devEngines": {
|
"engines": {
|
||||||
"packageManager": {
|
"pnpm": ">=11.4.0 <12"
|
||||||
"name": "pnpm",
|
|
||||||
"version": "^11.4.0",
|
|
||||||
"onFail": "download"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"type": "module",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||||
"fastify": "^5.2.1",
|
"fastify": "^5.2.1",
|
||||||
|
|||||||
@@ -51,11 +51,15 @@ export default class McpSession {
|
|||||||
|
|
||||||
this.registeredTools.push(
|
this.registeredTools.push(
|
||||||
...toolsToRegister
|
...toolsToRegister
|
||||||
.map((tool) => this.mcp.registerTool(
|
.map(
|
||||||
tool.title,
|
(tool) => this.mcp.registerTool(
|
||||||
tool.config,
|
tool.title,
|
||||||
tool.handler,
|
// ugly workaround for TS2589 error
|
||||||
))
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
tool.config as any,
|
||||||
|
tool.handler,
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,19 @@ export const listToolsTool: ToolDef = {
|
|||||||
type: "text",
|
type: "text",
|
||||||
text: JSON.stringify(
|
text: JSON.stringify(
|
||||||
Object.values(server.tools)
|
Object.values(server.tools)
|
||||||
.map((tool) => ({
|
.map((tool) => {
|
||||||
...tool,
|
// ugly workaround for TS2589 error
|
||||||
config: {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
...tool.config,
|
const zodObject = (z.object as any)(tool.config.inputSchema);
|
||||||
inputSchema: zodToJsonSchema(z.object(tool.config.inputSchema), { target: "jsonSchema7" }),
|
const inputSchema = zodToJsonSchema(zodObject, { target: "jsonSchema7" });
|
||||||
|
return {
|
||||||
|
...tool,
|
||||||
|
config: {
|
||||||
|
...tool.config,
|
||||||
|
inputSchema,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})),
|
}),
|
||||||
null,
|
null,
|
||||||
2,
|
2,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ESNext",
|
"module": "CommonJS",
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"lib": ["ES2022"],
|
"lib": ["ES2022"],
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
|
|||||||
Reference in New Issue
Block a user