FROM lukemathwalker/cargo-chef:latest-rust-1.67.1-slim AS chef FROM chef AS planner COPY . . RUN cargo chef prepare --recipe-path worker-recipe.json FROM chef AS builder COPY --from=planner worker-recipe.json worker-recipe.json RUN apt-get update && apt-get install -y libudev-dev clang pkg-config libssl-dev build-essential cmake RUN rustup component add rustfmt RUN cargo chef cook --release --recipe-path worker-recipe.json # Build application COPY . . RUN cargo build --release --bin worker # We do not need the Rust toolchain to run the binary! FROM debian:bullseye-slim AS runtime COPY --from=builder /target/release/worker /usr/local/bin ENTRYPOINT ["/usr/local/bin/worker"]