Add REST API server, Docker support, and CI pipeline

- Add FastAPI-based REST API server (api_server.py)
- Add Dockerfile and docker-compose.yaml for containerized deployment
- Add Gitea Actions CI workflow for building and pushing images
- Refactor CLI to support dual-server SSH (bouncer + crowdsec)
- Update dependencies with FastAPI and uvicorn
- Update CLAUDE.md and README.md with full documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kaffa
2026-02-09 11:51:03 +09:00
parent fee4636363
commit 6a26c0c4e4
11 changed files with 1219 additions and 56 deletions

View File

@@ -0,0 +1,54 @@
name: Build and Push Container Image
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
REGISTRY: gitea.anvil.it.com
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build image
run: |
podman build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} .
podman tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Tag version
if: startsWith(gitea.ref, 'refs/tags/v')
run: |
VERSION=${GITEA_REF#refs/tags/}
podman tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
- name: Login to Registry
if: gitea.event_name != 'pull_request'
run: |
podman login ${{ env.REGISTRY }} \
-u ${{ gitea.actor }} \
-p ${{ secrets.GITEA_TOKEN }}
- name: Push image
if: gitea.event_name != 'pull_request'
run: |
podman push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
podman push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Push version tag
if: startsWith(gitea.ref, 'refs/tags/v')
run: |
VERSION=${GITEA_REF#refs/tags/}
podman push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}