# Based on https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/ FROM rust:1.57.0 AS build MAINTAINER Jesse Morgan WORKDIR /usr/src # Build the dependencies first # This should help repeated builds go faster. RUN USER=root cargo new flowerpot WORKDIR /usr/src/flowerpot COPY Cargo.toml Cargo.lock ./ RUN cargo build --release # Copy the source and build the application. COPY src ./src RUN cargo install --path . # Now build the deployment image. FROM debian:stable-slim # RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y libssl1.1 ca-certificates sqlite3 COPY --from=build /usr/local/cargo/bin/flowerpot . COPY www ./www USER 999 CMD ["./flowerpot"]