# RLM Executor - Lightweight Docker Image
# Target: <50MB, alpine-based
# Purpose: Execute RLM commands in isolated containers

FROM rust:1.75-alpine AS builder

# Install build dependencies
RUN apk add --no-cache musl-dev

# Set working directory
WORKDIR /build

# Copy executor source
COPY Cargo.toml ./
COPY src ./src

# Build static binary
RUN cargo build --release --target x86_64-unknown-linux-musl

# Runtime stage
FROM alpine:3.19

# Install runtime dependencies (minimal)
RUN apk add --no-cache \
    ca-certificates \
    grep \
    bash

# Copy executor binary
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/executor /executor

# Make executable
RUN chmod +x /executor

# Set default entrypoint
ENTRYPOINT ["/executor"]

# Metadata
LABEL org.opencontainers.image.title="VAPORA RLM Executor"
LABEL org.opencontainers.image.description="Lightweight executor for RLM distributed reasoning tasks"
LABEL org.opencontainers.image.version="1.2.0"
