From 9e53f7f9cddeec7e159db75843f69ec007e9402d Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Tue, 17 Nov 2020 17:31:12 -0800 Subject: [PATCH] Optimize Dockerfile for Image Size --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 019e547..d36d364 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM rust:latest - +FROM rust:latest as builder WORKDIR /usr/src/libreddit COPY . . - RUN cargo install --path . +FROM debian:buster-slim +RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/* +COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit CMD ["libreddit"] \ No newline at end of file