# Build stage
FROM rust:1.85-slim AS builder
WORKDIR /src
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
COPY crates ./crates
COPY tools ./tools
RUN cargo build --release -p server

# Runtime stage
FROM debian:stable-slim
RUN useradd --system --uid 10001 ironarc
WORKDIR /app
COPY --from=builder /src/target/release/server /app/server
USER ironarc
ENV BIND=0.0.0.0:8080
EXPOSE 8080
ENTRYPOINT ["/app/server"]
