vecmindb 0.1.0

High-performance vector database with multiple index algorithms (HNSW, IVF, etc.) and NSGA-II auto-tuning.
# Build stage
FROM rust:1.76-slim-bookworm as builder

WORKDIR /usr/src/app

# Install build dependencies
# build-essential for gcc/linker
# pkg-config and libssl-dev for some dependencies (reqwest/actix)
RUN apt-get update && apt-get install -y \
    build-essential \
    pkg-config \
    libssl-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy manifests first for caching dependencies
COPY Cargo.toml Cargo.lock ./

# Create dummy src/lib.rs and src/main.rs to build dependencies
RUN mkdir -p src \
    && echo "fn main() {}" > src/main.rs \
    && echo "pub fn dummy() {}" > src/lib.rs

# Build dependencies only (release mode)
# Include features needed for server
RUN cargo build --release --bin vecmindb-server --features http-server

# Now copy the actual source code
COPY src ./src
COPY examples ./examples

# Touch main.rs to force rebuild of the binary
RUN touch src/main.rs

# Build the actual application
RUN cargo build --release --bin vecmindb-server --features http-server

# Runtime stage
FROM debian:bookworm-slim

WORKDIR /app

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    ca-certificates \
    libssl3 \
    && rm -rf /var/lib/apt/lists/*

# Copy the binary from builder
COPY --from=builder /usr/src/app/target/release/vecmindb-server /usr/local/bin/vecmindb-server

# Create data directory
RUN mkdir -p /data
ENV VECMINDB_STORAGE_PATH=/data
ENV VECMINDB_HOST=0.0.0.0
ENV VECMINDB_PORT=8080

# Expose port
EXPOSE 8080

# Run the server
CMD ["vecmindb-server"]