Skip to content

Commit 008077e

Browse files
committed
added docker support
1 parent 2ff862a commit 008077e

File tree

4 files changed

+123
-1
lines changed

4 files changed

+123
-1
lines changed

.github/workflows/docker-build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write # Needed to push to GitHub Container Registry
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ghcr.io/${{ github.repository }}
37+
tags: |
38+
# Use 'latest' for the main branch
39+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
40+
# Use the git sha for other refs (like PRs)
41+
type=sha,prefix=,suffix=,format=short
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ghcr.io/astral-sh/uv:debian-slim
2+
3+
# Set the working directory in the container
4+
WORKDIR /app
5+
6+
COPY . .
7+
8+
RUN uv sync
9+
10+
RUN uv run pytest -vvv
11+
12+
# Expose the port the app runs on (adjust if your server runs on a different port)
13+
EXPOSE 3001
14+
15+
# Define the command to run the application
16+
CMD ["uv", "run", "server"]

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,37 @@ uv sync
6565
uv run server
6666
```
6767

68+
### Docker Deployment
69+
70+
The easiest way to run the MCP server is using Docker. The project provides a pre-built Docker image available on GitHub Container Registry.
71+
72+
1. Using Docker Compose (recommended):
73+
74+
```bash
75+
# Clone the repository
76+
git clone git@github.com:longevity-genie/biothings-mcp.git
77+
cd biothings-mcp
78+
79+
# Start the services
80+
docker-compose up
81+
```
82+
83+
This will start:
84+
- The MCP server on port 3001
85+
- The MCP Inspector on port 6277
86+
87+
2. Using Docker directly:
88+
89+
```bash
90+
# Pull the latest image
91+
docker pull ghcr.io/longevity-genie/biothings-mcp:latest
92+
93+
# Run the container
94+
docker run -p 3001:3001 -e MCP_PORT=3001 ghcr.io/longevity-genie/biothings-mcp:latest
95+
```
96+
97+
The MCP server will be available at `http://localhost:3001/mcp`.
98+
6899
### Integration with AI Systems
69100

70101
Configure your AI system to use the MCP server in one of two ways:
@@ -89,7 +120,7 @@ Configure your AI system to use the MCP server in one of two ways:
89120
"args": [
90121
"mcp-remote",
91122
"http://localhost:3001/mcp",
92-
"8080" // Optional port number for OAuth support
123+
"6277" // Optional port number for OAuth support
93124
]
94125
}
95126
}

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
services:
2+
app:
3+
image: ghcr.io/longevity-genie/biothings-mcp:latest
4+
ports:
5+
- "3001:3001"
6+
environment:
7+
- MCP_PORT=3001
8+
networks:
9+
- mcp-network
10+
11+
inspector:
12+
image: mcp/inspector
13+
ports:
14+
- "6277:6277"
15+
environment:
16+
- MCP_SERVER_URL=http://app:3001/mcp
17+
depends_on:
18+
- app
19+
networks:
20+
- mcp-network
21+
22+
networks:
23+
mcp-network:
24+
driver: bridge

0 commit comments

Comments
 (0)