Skip to content

Commit f8d8da9

Browse files
author
karmaking
committed
add build pipeline and deployment docs
1 parent 75bb4d3 commit f8d8da9

4 files changed

Lines changed: 194 additions & 0 deletions

File tree

.dockerignore

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
pip-wheel-metadata/
20+
share/python-wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
MANIFEST
25+
26+
# Virtual environments
27+
.env
28+
.venv
29+
env/
30+
venv/
31+
ENV/
32+
env.bak/
33+
venv.bak/
34+
ai_env
35+
36+
# IDE
37+
.vscode/
38+
.idea/
39+
*.swp
40+
*.swo
41+
*~
42+
.DS_Store
43+
44+
# Git
45+
.git/
46+
.gitignore
47+
.gitattributes
48+
49+
# Testing
50+
.pytest_cache/
51+
.coverage
52+
htmlcov/
53+
.tox/
54+
.nox/
55+
56+
# Documentation
57+
*.md
58+
docs/
59+
!README.md
60+
61+
# CI/CD
62+
.github/
63+
.gitlab-ci.yml
64+
65+
# Database data (generated at runtime)
66+
database/data/
67+
68+
# Logs
69+
*.log
70+
71+
# Other
72+
*.bak
73+
*.tmp
74+
.cache/
75+
tests/
76+
77+
# Lock files (keeping poetry.lock for reference but using uv.lock)
78+
poetry.lock
79+
80+
# License files (optional to exclude)
81+
LICENSE
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and publish container
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
DOCKER_HUB_ORGANIZATION: ${{ vars.DOCKER_HUB_ORGANIZATION }}
11+
DOCKER_HUB_REPOSITORY: obp-mcp
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Build the Docker image
19+
run: |
20+
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
21+
docker build . --file Dockerfile --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:main --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest
22+
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
23+
echo docker done
24+
25+
- uses: sigstore/cosign-installer@main
26+
27+
- name: Write signing key to disk (only needed for `cosign sign --key`)
28+
run: echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > cosign.key
29+
30+
- name: Sign container image
31+
run: |
32+
cosign sign -y --key cosign.key \
33+
docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:main
34+
env:
35+
COSIGN_PASSWORD: "${{secrets.COSIGN_PASSWORD}}"
36+
37+
38+

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
FROM python:3.12-slim AS builder
3+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
4+
WORKDIR /app
5+
COPY pyproject.toml uv.lock ./
6+
RUN uv sync --frozen --no-dev
7+
8+
FROM python:3.12-slim
9+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
10+
WORKDIR /app
11+
COPY --from=builder /app/.venv /app/.venv
12+
COPY src/ ./src/
13+
COPY database/ ./database/
14+
COPY scripts/ ./scripts/
15+
COPY pyproject.toml uv.lock ./
16+
COPY run_server.sh ./
17+
RUN chmod +x run_server.sh
18+
RUN mkdir -p database/data
19+
20+
ENV PYTHONUNBUFFERED=1
21+
ENV PATH="/app/.venv/bin:$PATH"
22+
ENV FASTMCP_HOST=0.0.0.0
23+
ENV FASTMCP_PORT=9100
24+
ENV OBP_BASE_URL=https://apisandbox.openbankproject.com
25+
ENV OBP_API_VERSION=v5.1.0
26+
27+
EXPOSE 9100
28+
29+
CMD ["sh", "-c", "uv run python scripts/generate_endpoint_index.py && uv run python scripts/generate_glossary_index.py && ./run_server.sh"]

docker-compose.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: '3.8'
2+
3+
services:
4+
obp-mcp:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: obp-mcp-server
9+
ports:
10+
- "${FASTMCP_PORT:-9100}:9100"
11+
environment:
12+
# Server Configuration
13+
FASTMCP_HOST: 0.0.0.0
14+
FASTMCP_PORT: 9100
15+
16+
# OBP API Configuration
17+
OBP_BASE_URL: ${OBP_BASE_URL:-https://apisandbox.openbankproject.com}
18+
OBP_API_VERSION: ${OBP_API_VERSION:-v5.1.0}
19+
20+
# Authentication Configuration (optional)
21+
ENABLE_OAUTH: ${ENABLE_OAUTH:-false}
22+
AUTH_PROVIDER: ${AUTH_PROVIDER:-bearer-only}
23+
OBP_OIDC_ISSUER_URL: ${OBP_OIDC_ISSUER_URL:-}
24+
BASE_URL: ${BASE_URL:-http://localhost:9100}
25+
26+
# Python Configuration
27+
PYTHONUNBUFFERED: 1
28+
volumes:
29+
# Mount database/data for persistent storage of generated indexes
30+
- ./database/data:/app/database/data
31+
32+
# Optional: Mount .env file if you prefer file-based config
33+
# - ./.env:/app/.env:ro
34+
restart: unless-stopped
35+
healthcheck:
36+
test: ["CMD", "curl", "-f", "http://localhost:9100/health"]
37+
interval: 30s
38+
timeout: 10s
39+
retries: 3
40+
start_period: 40s
41+
networks:
42+
- obp-network
43+
44+
networks:
45+
obp-network:
46+
driver: bridge

0 commit comments

Comments
 (0)