FROM rust:1.95-bullseye AS builder

WORKDIR /app

RUN apt-get update \
    && apt-get install -y --no-install-recommends pkg-config libssl-dev ca-certificates \
    && rm -rf /var/lib/apt/lists/*

COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY README.md ./
COPY syntax-reference.md ./

RUN cargo build --release --locked --bins

FROM debian:bullseye-slim

RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates openssl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /workspace

COPY --from=builder /app/target/release/hen /usr/local/bin/hen
COPY --from=builder /app/target/release/hen-mcp /usr/local/bin/hen-mcp