# Stage 1: Build the Rust application FROM rust:alpine as builder # Install necessary dependencies RUN apk add --no-cache musl-dev && \ rustup target add x86_64-unknown-linux-musl # Set the working directory WORKDIR /app # Copy the source code COPY . . # Build the Rust binary RUN cargo build --release --target x86_64-unknown-linux-musl # Stage 2: Create the minimal runtime image FROM alpine:latest # Set the image name LABEL name="kotasks" # Install necessary libraries RUN apk add --no-cache libgcc # Set the working directory WORKDIR /app # Copy the built binary from the builder stage COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/kotasks . # Run the binary CMD ["./kotasks"]