# Build stage
FROM rust:1-bookworm AS builder
WORKDIR /app

# Copy manifests and source
COPY Cargo.toml Cargo.lock* ./
COPY config.yaml config.yaml
COPY table_id_map.yaml table_id_map.yaml
COPY config ./config
COPY src ./src
COPY generated ./generated

# Build release binary
RUN cargo build --release

# Runtime stage
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

    
WORKDIR /app
COPY --from=builder /app/target/release/athena_rs /app/athena_rs
COPY config.yaml ./config.yaml
COPY table_id_map.yaml table_id_map.yaml
COPY config ./config

ENV RUST_LOG=info
EXPOSE 4052

CMD ["/app/athena_rs", "--api-only", "--port", "4052"]
