FROM rust:1.47 as builder WORKDIR /usr/src/sarcastifybot # Avoid having to install/build all dependencies by copying # the Cargo files and making a dummy src/main.rs COPY Cargo.toml . COPY Cargo.lock . RUN mkdir -p src && echo "fn main() {}" > src/main.rs RUN cargo build --release # We need to touch our real main.rs file or else docker will use # the cached one. COPY . . RUN touch src/main.rs RUN cargo build --release FROM debian:buster RUN apt-get update && apt-get install -y openssl ca-certificates COPY --from=builder /usr/src/sarcastifybot/target/release/sarcastifybot /usr/local/bin/sarcastifybot CMD ["sarcastifybot"]