# ---------------------------------------------------------------------- # Stage 1: Build the Rust application # ---------------------------------------------------------------------- # Use a standard Rust image for building FROM rust:1.90.0-slim-trixie AS builder # Arguments for the repository and binary name (MUST BE UPDATED BY THE USER) # 1. Update this URL to your desired Git repository. ARG GIT_REPO="https://github.com/marcoforlin/tabby.git" # 2. Update this to the folder name the repository creates (usually the repo name). ARG REPO_NAME="tabby" # 3. Update this to the name of the executable generated by cargo (often matches the project name). ARG BINARY_NAME="tabby-mcp" # Install Git, required for cloning RUN apt-get update \ && apt-get install -y git pkg-config openssl libssl-dev\ && rm -rf /var/lib/apt/lists/* # Set the working directory for cloning and building WORKDIR /app RUN echo "blbabal" RUN git clone --depth 1 $GIT_REPO $REPO_NAME # Change directory into the cloned repository WORKDIR /app/$REPO_NAME/crates/tabby-mcp # Build the project in release (optimized) mode RUN cargo build # ---------------------------------------------------------------------- # Stage 2: Minimal Runtime Image # ---------------------------------------------------------------------- # Use a minimal, lightweight base image for the final runtime FROM debian:trixie-slim RUN apt-get update && apt-get install -y curl procps RUN curl -fsSL https://ollama.com/install.sh | sh RUN ollama serve & sleep 5 && ollama pull nomic-embed-text && pkill ollama # Set the working directory to where the binary will be executed WORKDIR /usr/local/bin/ EXPOSE 8080 # Copy the built binary from the build stage into the minimal image # NOTE: The variable references here MUST match the ARGs defined in the build stage. COPY --from=builder /app/tabby/target/debug/tabby-mcp /usr/local/bin/ COPY run_tools.sh /run_tools.sh RUN chmod +x /run_tools.sh CMD ["/run_tools.sh"]