# Build stage
FROM rust:1 AS builder
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
# Build the application in release mode
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy the compiled binary from builder stage
COPY --from=builder /app/target/release/csvlint /usr/local/bin/csvlint
# Create a non-root user
RUN useradd -r -s /bin/false csvlint
USER csvlint
ENTRYPOINT ["csvlint"]