Skip to content

Commit 42c05e4

Browse files
committed
Add Dockerfile and fine-tune to run in containers
* Raise the log level to INFO * Listen to 0.0.0.0 by default when running in a container, as 127.0.0.1 will not be visible outside the container * Rename the binary to elasticsearch-core-mcp-server
1 parent 02107bb commit 42c05e4

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
npm-package
2+
docs
3+
target
4+
.idea
5+
.vscode

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright Elasticsearch B.V. and contributors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# To create a multi-arch image, run:
5+
# docker buildx build --platform linux/amd64,linux/arm64 --tag elasticsearch-core-mcp-server .
6+
7+
FROM rust:1.88 AS builder
8+
9+
WORKDIR /app
10+
11+
COPY Cargo.toml Cargo.lock ./
12+
COPY crates/elastic-mcp/Cargo.toml ./crates/elastic-mcp/
13+
14+
# Cache dependencies
15+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
16+
--mount=type=cache,target=/app/target \
17+
mkdir -p ./crates/elastic-mcp/src/bin && \
18+
echo "pub fn main() {}" > ./crates/elastic-mcp/src/bin/elasticsearch-core-mcp-server.rs && \
19+
cargo build --release --bin elasticsearch-core-mcp-server
20+
21+
COPY crates ./crates/
22+
23+
RUN cargo build --release --bin elasticsearch-core-mcp-server
24+
25+
#--------------------------------------------------------------------------------------------------
26+
27+
FROM cgr.dev/chainguard/wolfi-base:latest
28+
29+
COPY --from=builder /app/target/release/elasticsearch-core-mcp-server /usr/local/bin/elasticsearch-core-mcp-server
30+
31+
ENTRYPOINT ["/usr/local/bin/elasticsearch-core-mcp-server"]

0 commit comments

Comments
 (0)