# Build stage FROM rust:slim-bookworm as build # Install build dependencies RUN apt-get update && \ apt-get install -y \ git \ pkg-config \ make \ g++ \ libssl-dev \ libtiff-dev \ clang \ libclang-dev \ pkg-config \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Add target RUN rustup target add x86_64-unknown-linux-gnu # Create a new empty shell project RUN USER=root cargo new --bin quoter WORKDIR /quoter # Copy manifests COPY ./Cargo.lock ./Cargo.lock COPY ./Cargo.toml ./Cargo.toml # Cache dependencies ENV CARGO_NET_GIT_FETCH_WITH_CLI=true RUN cargo build --release # Remove the default source file created by cargo new RUN rm src/*.rs # Copy source code COPY ./src ./src # Build for release RUN rm ./target/release/deps/quoter* RUN cargo build --release # Final stage FROM debian:bookworm-slim # Install runtime dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ libssl3 \ libtiff6 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Copy the build artifact from the build stage COPY --from=build /quoter/target/release/quoter . # Set the startup command CMD ["./quoter"]