# Stage 1: Build
FROM rust:1.91.1-slim AS builder

# Create app directory
WORKDIR /usr/src/app

# Copy source code
COPY . .

# Build the actual app
RUN cargo build --release

# Stage 2: Runtime
FROM debian:stable-slim

# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/app/target/release/node-monitoring /usr/local/bin/node-monitoring

CMD ["/usr/local/bin/node-monitoring"]