-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
51 lines (38 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Multi-stage build for cortex-http REST API
# ── Stage 1: Build ───────────────────────────────────────────────────────────
FROM rust:1.85-bookworm AS builder
WORKDIR /src
# Install build deps for fastembed/ONNX
RUN apt-get update && apt-get install -y cmake pkg-config && rm -rf /var/lib/apt/lists/*
# Copy workspace
COPY Cargo.toml Cargo.lock ./
COPY cortex-core/ cortex-core/
COPY cortex-http/ cortex-http/
COPY cortex-mcp-server/ cortex-mcp-server/
# Stub out cortex-python and cortex-wasm so workspace resolves without their deps
RUN mkdir -p cortex-python/src && \
printf '[package]\nname = "cortex-python"\nversion = "0.1.0"\nedition = "2021"\n\n[lib]\ncrate-type = ["cdylib"]\npath = "src/lib.rs"' > cortex-python/Cargo.toml && \
echo '' > cortex-python/src/lib.rs && \
mkdir -p cortex-wasm/src && \
printf '[package]\nname = "cortex-wasm"\nversion = "2.0.0"\nedition = "2021"\n\n[lib]\ncrate-type = ["cdylib"]\npath = "src/lib.rs"' > cortex-wasm/Cargo.toml && \
echo '' > cortex-wasm/src/lib.rs
# Build release binaries (HTTP server + MCP server)
RUN cargo build --release -p cortex-http -p cortex-mcp-server
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/target/release/cortex-http /usr/local/bin/cortex-http
COPY --from=builder /src/target/release/cortex-mcp-server /usr/local/bin/cortex-mcp-server
# MCP Registry ownership verification
LABEL io.modelcontextprotocol.server.name="io.github.gambletan/cortex"
# Data volume for SQLite persistence
VOLUME /data
ENV CORTEX_DB_PATH=/data/memory.db
ENV CORTEX_HOST=0.0.0.0
ENV CORTEX_PORT=3315
EXPOSE 3315
# HTTP mode (default): docker run -p 3315:3315 image
# MCP stdio mode: docker run --entrypoint cortex-mcp-server image /data/memory.db
ENTRYPOINT ["cortex-http"]