|
1 | | -# This Dockerfile is a symlink target for tools that require "Dockerfile" |
2 | | -# at the repository root. The canonical container definition is at |
3 | | -# container/Containerfile. |
4 | | -# |
5 | | -# Usage: docker build -t boj-server:latest . |
6 | | -# Or: podman build -t boj-server:latest -f container/Containerfile . |
7 | | - |
8 | | -# Include the real Containerfile contents: |
9 | 1 | # SPDX-License-Identifier: PMPL-1.0-or-later |
10 | | -# Bundle of Joy Server Container Image |
11 | | -# |
12 | | -# Multi-stage build: Zig FFI compilation + pre-built V adapter binary. |
13 | | -# |
14 | | -# Prerequisites: |
15 | | -# just build-adapter # Build the V binary locally first |
16 | | -# |
17 | | -# Build with Podman: |
18 | | -# podman build -t boj-server:latest -f container/Containerfile . |
19 | | -# |
20 | | -# Run: |
21 | | -# podman run -p 7700:7700 -p 7701:7701 -p 7702:7702 boj-server:latest |
22 | | -# |
23 | | -# Run with persistent volume: |
24 | | -# podman run -p 7700:7700 -p 7701:7701 -p 7702:7702 \ |
25 | | -# -v boj-server-data:/data boj-server:latest |
26 | | - |
27 | | -# ============================================================================ |
28 | | -# Stage 1: FFI Builder |
29 | | -# ============================================================================ |
| 2 | +# Lightweight MCP stdio bridge for inspection and deployment. |
| 3 | +# Runs only the Node.js MCP bridge (zero dependencies). |
| 4 | +# The bridge responds to MCP initialize + tools/list with the full |
| 5 | +# cartridge tool manifest. |
30 | 6 | # |
31 | | -# Compiles all Zig FFI layers (core + 18 cartridges) in ReleaseFast mode. |
32 | | -# The V adapter binary is built locally and copied in — V compiler is not |
33 | | -# available in Wolfi packages. |
34 | | - |
35 | | -FROM cgr.dev/chainguard/wolfi-base:latest AS builder |
36 | | - |
37 | | -# Install Zig toolchain for FFI compilation |
38 | | -RUN apk add --no-cache build-base zig |
39 | | - |
40 | | -WORKDIR /build |
41 | | - |
42 | | -# Copy source tree |
43 | | -COPY . . |
44 | | - |
45 | | -# Build core FFI (catalogue, loader, guardian, federation, readiness, verisimdb, e2e) |
46 | | -RUN cd ffi/zig && zig build -Doptimize=ReleaseFast |
47 | | - |
48 | | -# Build all 18 cartridge FFI shared libraries |
49 | | -RUN for cart in database fleet nesy agent cloud container k8s git \ |
50 | | - secrets queues iac observe ssg proof lsp dap bsp feedback; do \ |
51 | | - echo "Building ${cart}-mcp FFI..." && \ |
52 | | - cd /build/cartridges/${cart}-mcp/ffi && \ |
53 | | - zig build -Doptimize=ReleaseFast || exit 1; \ |
54 | | - done |
55 | | - |
56 | | -# ============================================================================ |
57 | | -# Stage 2: Runtime |
58 | | -# ============================================================================ |
| 7 | +# For the full production image with Zig FFI + V adapter, use: |
| 8 | +# podman build -f container/Containerfile . |
59 | 9 | # |
60 | | -# Minimal production image. Only the compiled binary, shared libraries, |
61 | | -# and runtime dependencies are included. |
| 10 | +# Usage: |
| 11 | +# podman build -t boj-server:latest . |
| 12 | +# echo '{"jsonrpc":"2.0","id":1,"method":"initialize",...}' | podman run -i boj-server |
62 | 13 |
|
63 | | -FROM cgr.dev/chainguard/wolfi-base:latest |
| 14 | +FROM node:22-slim |
64 | 15 |
|
65 | | -# OCI image labels (compatible with cerro-torre .ctp bundle metadata) |
66 | | -LABEL org.opencontainers.image.title="Bundle of Joy Server" \ |
67 | | - org.opencontainers.image.description="Unified server capability catalogue with formally verified cartridges, distributed community hosting, and the Teranga menu system" \ |
| 16 | +LABEL org.opencontainers.image.title="Bundle of Joy Server (MCP Bridge)" \ |
| 17 | + org.opencontainers.image.description="MCP stdio transport for BoJ cartridge toolkit" \ |
68 | 18 | org.opencontainers.image.url="https://github.com/hyperpolymath/boj-server" \ |
69 | 19 | org.opencontainers.image.source="https://github.com/hyperpolymath/boj-server" \ |
70 | 20 | org.opencontainers.image.vendor="hyperpolymath" \ |
71 | | - org.opencontainers.image.licenses="PMPL-1.0-or-later" \ |
72 | | - org.opencontainers.image.authors="Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>" \ |
73 | | - dev.cerrotorre.manifest="container/manifest.toml" \ |
74 | | - dev.cerrotorre.gatekeeper="container/.gatekeeper.yaml" \ |
75 | | - dev.stapeln.compose="container/compose.toml" |
76 | | - |
77 | | -# Minimal runtime dependencies |
78 | | -RUN apk add --no-cache ca-certificates curl |
79 | | - |
80 | | -# Create non-root user |
81 | | -RUN addgroup -S appuser && adduser -S appuser -G appuser |
| 21 | + org.opencontainers.image.licenses="MPL-2.0" \ |
| 22 | + org.opencontainers.image.authors="Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>" |
82 | 23 |
|
83 | 24 | WORKDIR /app |
84 | 25 |
|
85 | | -# Copy pre-built V adapter binary (built locally via just build-adapter) |
86 | | -COPY adapter/v/boj-server /app/boj-server |
87 | | -RUN chmod +x /app/boj-server |
88 | | - |
89 | | -# Copy core FFI libraries from builder stage |
90 | | -COPY --from=builder /build/ffi/zig/zig-out/ /app/lib/core/ |
91 | | - |
92 | | -# Copy all 18 cartridge .so files from builder stage |
93 | | -COPY --from=builder /build/cartridges/database-mcp/ffi/zig-out/ /app/lib/cartridges/database-mcp/ |
94 | | -COPY --from=builder /build/cartridges/fleet-mcp/ffi/zig-out/ /app/lib/cartridges/fleet-mcp/ |
95 | | -COPY --from=builder /build/cartridges/nesy-mcp/ffi/zig-out/ /app/lib/cartridges/nesy-mcp/ |
96 | | -COPY --from=builder /build/cartridges/agent-mcp/ffi/zig-out/ /app/lib/cartridges/agent-mcp/ |
97 | | -COPY --from=builder /build/cartridges/cloud-mcp/ffi/zig-out/ /app/lib/cartridges/cloud-mcp/ |
98 | | -COPY --from=builder /build/cartridges/container-mcp/ffi/zig-out/ /app/lib/cartridges/container-mcp/ |
99 | | -COPY --from=builder /build/cartridges/k8s-mcp/ffi/zig-out/ /app/lib/cartridges/k8s-mcp/ |
100 | | -COPY --from=builder /build/cartridges/git-mcp/ffi/zig-out/ /app/lib/cartridges/git-mcp/ |
101 | | -COPY --from=builder /build/cartridges/secrets-mcp/ffi/zig-out/ /app/lib/cartridges/secrets-mcp/ |
102 | | -COPY --from=builder /build/cartridges/queues-mcp/ffi/zig-out/ /app/lib/cartridges/queues-mcp/ |
103 | | -COPY --from=builder /build/cartridges/iac-mcp/ffi/zig-out/ /app/lib/cartridges/iac-mcp/ |
104 | | -COPY --from=builder /build/cartridges/observe-mcp/ffi/zig-out/ /app/lib/cartridges/observe-mcp/ |
105 | | -COPY --from=builder /build/cartridges/ssg-mcp/ffi/zig-out/ /app/lib/cartridges/ssg-mcp/ |
106 | | -COPY --from=builder /build/cartridges/proof-mcp/ffi/zig-out/ /app/lib/cartridges/proof-mcp/ |
107 | | -COPY --from=builder /build/cartridges/lsp-mcp/ffi/zig-out/ /app/lib/cartridges/lsp-mcp/ |
108 | | -COPY --from=builder /build/cartridges/dap-mcp/ffi/zig-out/ /app/lib/cartridges/dap-mcp/ |
109 | | -COPY --from=builder /build/cartridges/bsp-mcp/ffi/zig-out/ /app/lib/cartridges/bsp-mcp/ |
110 | | -COPY --from=builder /build/cartridges/feedback-mcp/ffi/zig-out/ /app/lib/cartridges/feedback-mcp/ |
111 | | - |
112 | | -# Copy entrypoint script |
113 | | -COPY container/entrypoint.sh /app/entrypoint.sh |
114 | | -RUN chmod +x /app/entrypoint.sh |
115 | | - |
116 | | -# Copy stapeln integration files |
117 | | -COPY container/.gatekeeper.yaml /etc/svalinn/gatekeeper.yaml |
118 | | -COPY container/manifest.toml /app/manifest.toml |
119 | | - |
120 | | -# Copy machine-readable config (menu, order-ticket) |
121 | | -COPY .machine_readable/servers/ /app/config/servers/ |
122 | | - |
123 | | -# Create data directory for persistent storage |
124 | | -RUN mkdir -p /data && chown appuser:appuser /data |
125 | | - |
126 | | -# Set ownership |
127 | | -RUN chown -R appuser:appuser /app |
128 | | - |
129 | | -# Environment variables |
130 | | -ENV APP_HOST=[::] |
131 | | -ENV APP_PORT=7700 |
132 | | -ENV APP_LOG_FORMAT=json |
133 | | -ENV APP_DATA_DIR=/data |
134 | | -ENV LD_LIBRARY_PATH=/app/lib/core/lib:/app/lib/cartridges/database-mcp/lib:/app/lib/cartridges/fleet-mcp/lib:/app/lib/cartridges/nesy-mcp/lib:/app/lib/cartridges/agent-mcp/lib:/app/lib/cartridges/cloud-mcp/lib:/app/lib/cartridges/container-mcp/lib:/app/lib/cartridges/k8s-mcp/lib:/app/lib/cartridges/git-mcp/lib:/app/lib/cartridges/secrets-mcp/lib:/app/lib/cartridges/queues-mcp/lib:/app/lib/cartridges/iac-mcp/lib:/app/lib/cartridges/observe-mcp/lib:/app/lib/cartridges/ssg-mcp/lib:/app/lib/cartridges/proof-mcp/lib:/app/lib/cartridges/lsp-mcp/lib:/app/lib/cartridges/dap-mcp/lib:/app/lib/cartridges/bsp-mcp/lib:/app/lib/cartridges/feedback-mcp/lib |
135 | | - |
136 | | -# Persistent storage volume |
137 | | -VOLUME ["/data"] |
138 | | - |
139 | | -# Run as non-root |
140 | | -USER appuser |
141 | | - |
142 | | -# Expose all three adapter ports |
143 | | -EXPOSE 7700 7701 7702 |
| 26 | +COPY package.json /app/ |
| 27 | +COPY mcp-bridge/ /app/mcp-bridge/ |
144 | 28 |
|
145 | | -# Health check via REST endpoint |
146 | | -HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ |
147 | | - CMD curl -sf http://localhost:${APP_PORT}/health || exit 1 |
| 29 | +# No npm install needed — zero dependencies |
| 30 | +USER node |
148 | 31 |
|
149 | | -ENTRYPOINT ["/app/entrypoint.sh"] |
150 | | -CMD ["/app/boj-server"] |
| 32 | +ENTRYPOINT ["node", "mcp-bridge/main.js"] |
0 commit comments