From 796148a341d4c0bbaffcbca536b6e8e1e8384106 Mon Sep 17 00:00:00 2001 From: SphericalKat Date: Tue, 29 Jun 2021 18:54:14 -0700 Subject: [PATCH] refactor(build): use multistage build for docker Signed-off-by: SphericalKat --- Dockerfile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 05e551e..882d55d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,19 @@ -FROM rustlang/rust:nightly +FROM rustlang/rust:nightly AS builder COPY . . RUN cargo build --release -CMD ["sh", "-c", "ROCKET_KEEP_ALIVE=0 ./target/release/katbin"] \ No newline at end of file +# CMD ["sh", "-c", "ROCKET_KEEP_ALIVE=0 ./target/release/katbin"] + +FROM debian:buster + +RUN apt-get update && apt-get install -y libpq-dev + +COPY --from=builder \ + /target/release/katbin\ + /usr/local/bin/ + +WORKDIR /root + +CMD /usr/local/bin/katbin \ No newline at end of file