-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (42 loc) · 1.3 KB
/
Copy pathDockerfile
File metadata and controls
57 lines (42 loc) · 1.3 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
52
53
54
55
56
57
FROM rust:alpine AS builder
# Install required system dependencies and build tools
RUN apk add --no-cache \
musl-dev \
gcc \
g++ \
make \
cmake \
pkgconfig \
perl
WORKDIR /usr/src/app
ARG CARGO_FEATURES=""
# Separate dependency cache build from earlier stages
# First copy Cargo.toml and Cargo.lock, as well as resources needed by the build script
COPY Cargo.toml Cargo.lock ./
COPY build.rs ./
COPY assets/ ./assets/
# Create a dummy entry file to build the dependency cache
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release ${CARGO_FEATURES} && \
rm -rf src
# Copy the actual project source code
COPY src ./src
# Ensure the main program is recompiled
RUN touch src/main.rs && cargo build --release ${CARGO_FEATURES}
# Runtime base image: Use Alpine
FROM alpine:latest
RUN apk add --no-cache \
ca-certificates \
tzdata
WORKDIR /app
# Copy the compiled binary from the builder image
COPY --from=builder /usr/src/app/target/release/memory-mcp-server /app/memory-mcp-server
# Copy assets needed for runtime (like the ONNX model, etc.)
COPY --from=builder /usr/src/app/assets /app/assets
# Default port is 9180
EXPOSE 9180
# Enable info level logging by default
ENV RUST_LOG=info
# Set the entrypoint
ENTRYPOINT ["/app/memory-mcp-server"]