Skip to content

Commit 8d58863

Browse files
authored
Merge pull request #4 from G-Core/feature/mcp-server-kv-stores
Feature/mcp server kv stores ready
2 parents d9b3516 + bb44184 commit 8d58863

28 files changed

Lines changed: 1008 additions & 1287 deletions

.github/build-push-docker/action.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ runs:
6060
context: .
6161
file: ./Dockerfile
6262
push: true
63+
platforms: linux/amd64,linux/arm64
6364
tags: ${{ steps.meta.outputs.tags }}
6465
labels: ${{ steps.meta.outputs.labels }}
6566
build-args: |

.github/workflows/build-docker-base-image.yml renamed to .github/workflows/build-docker-base-image.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
context: .
4949
file: ./Dockerfile-base
5050
push: true
51+
platforms: linux/amd64,linux/arm64
5152
tags: ${{ steps.meta.outputs.tags }}
5253
labels: ${{ steps.meta.outputs.labels }}
5354
cache-from: type=gha

DEVELOPMENT.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ Edit your `.vscode/mcp.json` in your workspace with the following FASTEDGE_API_U
1212
"command": "bash",
1313
"args": [
1414
"-c",
15-
"docker run --user $(id -u):$(id -g) --rm -i -v \"$WORKSPACE_ROOT:/workspace\" -e \"WORKSPACE_ROOT=/workspace\" -e \"FASTEDGE_API_KEY=$FASTEDGE_API_KEY\" -e \"FASTEDGE_API_URL=$FASTEDGE_API_URL\" ghcr.io/g-core/fastedge-mcp-server:latest"
15+
"docker run --rm -i -v ${workspaceFolder}:/workspace -e WORKSPACE_ROOT=/workspace -e \"FASTEDGE_API_KEY=$FASTEDGE_API_KEY\" -e \"FASTEDGE_API_URL=$FASTEDGE_API_URL\" ghcr.io/g-core/fastedge-mcp-server:latest"
1616
],
1717
"env": {
18-
"WORKSPACE_ROOT": "${workspaceFolder}",
1918
"FASTEDGE_API_KEY": "your_api_key_here",
2019
"FASTEDGE_API_URL": "https://api.preprod.world" # Optional environment setting
2120
}

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ RUN npm ci --omit=dev
2828
# Copy only the build output
2929
COPY --from=builder /app/build ./build
3030

31-
# Create required directories
32-
# RUN mkdir -p /workspace/apps
33-
3431
# Default to workspace in volumey
3532
ENV WORKSPACE_ROOT=/workspace
3633

3734
# Set up a volume mount point for workspace data
3835
VOLUME [ "/workspace" ]
3936

40-
# Start MCP server - use node directly for standalone execution
37+
# Start MCP server
4138
CMD ["node", "build/server.js"]
39+

Dockerfile-base

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,30 @@ RUN rustup target add wasm32-wasip1 && \
66
rm -rf /usr/local/rustup/toolchains/*/lib/rustlib/*/test /usr/local/rustup/toolchains/*/lib/rustlib/*/examples
77

88
# Install Node.js v23 using NodeSource binary distribution
9+
# Support multiple architectures
910
RUN apt-get update && \
10-
apt-get install -y --no-install-recommends curl ca-certificates xz-utils && \
11-
curl -fsSL https://nodejs.org/dist/v23.5.0/node-v23.5.0-linux-x64.tar.xz -o node.tar.xz && \
11+
apt-get install -y --no-install-recommends curl ca-certificates xz-utils bash && \
12+
ARCH=$(dpkg --print-architecture) && \
13+
case "$ARCH" in \
14+
amd64) NODE_ARCH="x64" ;; \
15+
arm64) NODE_ARCH="arm64" ;; \
16+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
17+
esac && \
18+
curl -fsSL https://nodejs.org/dist/v23.5.0/node-v23.5.0-linux-${NODE_ARCH}.tar.xz -o node.tar.xz && \
1219
tar -xJf node.tar.xz -C /usr/local --strip-components=1 && \
1320
rm node.tar.xz && \
1421
apt-get purge -y xz-utils && \
1522
apt-get autoremove -y && \
1623
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /usr/share/info /tmp/*
24+
25+
# Ensure bash is the default shell and set up proper shell environment for Windows Docker Desktop
26+
RUN ln -sf /bin/bash /bin/sh && \
27+
echo 'export PS1="\u@\h:\w\$ "' >> /etc/bash.bashrc && \
28+
echo 'export PATH=$PATH:/usr/local/bin' >> /etc/bash.bashrc
29+
30+
# Set default shell to bash for better Windows Docker Desktop compatibility
31+
SHELL ["/bin/bash", "-c"]
32+
33+
# Set environment variables for better shell experience
34+
ENV SHELL=/bin/bash
35+
ENV TERM=xterm-256color

MULTI-ARCHITECTURE.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Multi-Architecture Docker Support
2+
3+
## Overview
4+
5+
This project now supports multi-architecture Docker images that can run on:
6+
7+
- **Linux** (amd64, arm64)
8+
- **macOS** (via Docker Desktop)
9+
- **Windows** (via Docker Desktop with WSL2)
10+
11+
## Architecture Support
12+
13+
### Supported Platforms
14+
15+
- `linux/amd64` - Standard x86_64 Linux systems
16+
- `linux/arm64` - ARM64 Linux systems (Apple Silicon, ARM servers)
17+
18+
### Running on Different Platforms
19+
20+
#### Linux
21+
22+
```bash
23+
# Native support - will automatically use the correct architecture
24+
docker run ghcr.io/g-core/fastedge-mcp-server:latest
25+
```
26+
27+
#### macOS (Intel & Apple Silicon)
28+
29+
```bash
30+
# Docker Desktop automatically pulls the correct architecture
31+
# Intel Macs: linux/amd64
32+
# Apple Silicon Macs: linux/arm64
33+
docker run ghcr.io/g-core/fastedge-mcp-server:latest
34+
```
35+
36+
#### Windows
37+
38+
```bash
39+
# Docker Desktop with WSL2 backend
40+
docker run ghcr.io/g-core/fastedge-mcp-server:latest
41+
```
42+
43+
## Building Multi-Architecture Images
44+
45+
### Base Image
46+
47+
The base image is built using the existing workflow:
48+
49+
```bash
50+
# Use the build-docker-base-image.yaml workflow
51+
# Manually triggered via GitHub Actions UI or API
52+
```
53+
54+
### Main Image
55+
56+
The main application image is built using the multi-architecture base:
57+
58+
```bash
59+
# Use the build-push-docker action with platforms: linux/amd64,linux/arm64
60+
```
61+
62+
## Development Notes
63+
64+
### Local Multi-Architecture Building
65+
66+
#### Full Multi-Architecture Build (Requires Network Connectivity)
67+
68+
For environments with proper network connectivity and ARM64 emulation:
69+
70+
```bash
71+
# Set up buildx with docker-container driver (one-time setup)
72+
docker buildx create --name multiarch --driver docker-container --use
73+
docker buildx inspect --bootstrap
74+
75+
# Build base image for multiple architectures
76+
docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile-base -t fastedge-mcp-server-base:latest --load .
77+
78+
# Build main image for multiple architectures
79+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg BASE_IMAGE=fastedge-mcp-server-base:latest -t fastedge-mcp-server:latest --load .
80+
```
81+
82+
#### Single Architecture Build (Recommended for Local Development)
83+
84+
If you encounter network issues or want faster builds:
85+
86+
```bash
87+
# Use default driver (no special setup required)
88+
docker buildx use default
89+
90+
# Build base image for current platform only
91+
docker build -f Dockerfile-base -t fastedge-mcp-server-base:latest .
92+
93+
# Build main image for current platform
94+
docker build --build-arg BASE_IMAGE=fastedge-mcp-server-base:latest -t fastedge-mcp-server:latest .
95+
```
96+
97+
### Architecture-Specific Considerations
98+
99+
1. **Node.js Binaries**: The Dockerfile-base now automatically detects the target architecture and downloads the appropriate Node.js binary
100+
2. **Rust Compilation**: Rust toolchain supports cross-compilation for both amd64 and arm64
101+
3. **npm Dependencies**: Native dependencies are compiled for the target architecture during the build process
102+
103+
### Limitations
104+
105+
- **Windows Containers**: Not supported due to complexity and requirement for Windows hosts
106+
- **Performance**: ARM64 images may have slightly different performance characteristics
107+
- **Build Time**: Multi-architecture builds take longer due to building for multiple platforms
108+
109+
## Troubleshooting
110+
111+
### Platform-Specific Issues
112+
113+
If you encounter platform-specific issues, you can force a specific architecture:
114+
115+
```bash
116+
# Force amd64 on any platform
117+
docker run --platform linux/amd64 ghcr.io/g-core/fastedge-mcp-server:latest
118+
119+
# Force arm64 on any platform (if available)
120+
docker run --platform linux/arm64 ghcr.io/g-core/fastedge-mcp-server:latest
121+
```
122+
123+
### Build Issues
124+
125+
Common issues and solutions when building multi-architecture images:
126+
127+
#### 1. "Multi-platform build is not supported for the docker driver"
128+
129+
**Problem**: Using the default Docker driver which doesn't support multi-platform builds.
130+
131+
**Solution**:
132+
133+
```bash
134+
# Create and use a docker-container builder
135+
docker buildx create --name multiarch --driver docker-container --use
136+
docker buildx inspect --bootstrap
137+
```
138+
139+
**Alternative**: Use single-platform builds with the default driver:
140+
141+
```bash
142+
docker buildx use default
143+
docker build -f Dockerfile-base -t fastedge-mcp-server-base:latest .
144+
```
145+
146+
#### 2. Network connectivity issues (IPv6)
147+
148+
**Problem**: `dial tcp [IPv6]:443: connect: network is unreachable`
149+
150+
**Solutions**:
151+
152+
```bash
153+
# Option 1: Use default driver (often has better network compatibility)
154+
docker buildx use default
155+
docker build -f Dockerfile-base -t fastedge-mcp-server-base:latest .
156+
157+
# Option 2: Configure Docker daemon to prefer IPv4
158+
# Edit /etc/docker/daemon.json:
159+
# {
160+
# "ipv6": false,
161+
# "dns": ["8.8.8.8", "8.8.4.4"]
162+
# }
163+
# Then: sudo systemctl restart docker
164+
165+
# Option 3: Use Docker registry mirrors
166+
# Add --registry-mirror flag or configure in daemon.json
167+
```
168+
169+
#### 3. "No output specified with docker-container driver"
170+
171+
**Problem**: Warning about build results only staying in cache.
172+
173+
**Solution**: Always specify output with `--load` or `--push`:
174+
175+
```bash
176+
# Load into local Docker images
177+
docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile-base -t fastedge-mcp-server-base:latest --load .
178+
179+
# Push to registry (for CI/CD)
180+
docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile-base -t fastedge-mcp-server-base:latest --push .
181+
```
182+
183+
#### 4. General troubleshooting
184+
185+
- Check buildx status: `docker buildx ls`
186+
- Verify builder capabilities: `docker buildx inspect`
187+
- Ensure base images support target architectures
188+
- Test single-platform builds first
189+
- Use `--progress=plain` for detailed build output

0 commit comments

Comments
 (0)