From c133df0b70c1586899e9176d2f3dd1662e2ced27 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Wed, 5 May 2021 18:03:25 +0800 Subject: [PATCH 1/4] optimize datafusion-cli docker image size --- datafusion-cli/Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/datafusion-cli/Dockerfile b/datafusion-cli/Dockerfile index 32bd38b9419d..dfe7715cdf0a 100644 --- a/datafusion-cli/Dockerfile +++ b/datafusion-cli/Dockerfile @@ -15,14 +15,25 @@ # specific language governing permissions and limitations # under the License. -FROM rust:latest +FROM rust:alpine as builder +RUN apk add --no-cache \ + musl-dev -COPY ./datafusion ./usr/src/datafusion -COPY ./datafusion-cli ./usr/src/datafusion-cli +COPY ./datafusion /usr/src/datafusion + +COPY ./datafusion-cli /usr/src/datafusion-cli WORKDIR /usr/src/datafusion-cli -RUN cargo install --path . +RUN cargo build --release + +RUN ls -hal + +FROM alpine + +COPY --from=builder /usr/src/target/release/datafusion-cli /usr/local/bin + +ENTRYPOINT ["datafusion-cli"] -CMD ["datafusion-cli", "--data-path", "/data"] +CMD ["--data-path", "/data"] From 2b978bb56c6b08fe331fc155a39c1b0b4b8b2d6f Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Wed, 5 May 2021 19:33:54 +0800 Subject: [PATCH 2/4] update workspace def --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa36a0c0fed7..a65251f0a9e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,9 +20,9 @@ members = [ "datafusion", "datafusion-cli", "datafusion-examples", - "benchmarks", + "benchmarks", "ballista/rust/client", "ballista/rust/core", "ballista/rust/executor", "ballista/rust/scheduler", -] \ No newline at end of file +] From 5b6c53e1c88f0b710c0731aaabb2493c35f14bb8 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Wed, 5 May 2021 19:58:16 +0800 Subject: [PATCH 3/4] get rid of alpine --- datafusion-cli/Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/datafusion-cli/Dockerfile b/datafusion-cli/Dockerfile index dfe7715cdf0a..ec402574061f 100644 --- a/datafusion-cli/Dockerfile +++ b/datafusion-cli/Dockerfile @@ -15,10 +15,7 @@ # specific language governing permissions and limitations # under the License. -FROM rust:alpine as builder - -RUN apk add --no-cache \ - musl-dev +FROM rust:latest as builder COPY ./datafusion /usr/src/datafusion @@ -30,9 +27,9 @@ RUN cargo build --release RUN ls -hal -FROM alpine +FROM debian:buster -COPY --from=builder /usr/src/target/release/datafusion-cli /usr/local/bin +COPY --from=builder /usr/src/datafusion-cli/target/release/datafusion-cli /usr/local/bin ENTRYPOINT ["datafusion-cli"] From 04b9903ef860436b01e2c2081ea906fa3718be51 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Wed, 5 May 2021 20:04:54 +0800 Subject: [PATCH 4/4] use debian:buster-slim --- datafusion-cli/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/datafusion-cli/Dockerfile b/datafusion-cli/Dockerfile index ec402574061f..2a8ab16a2554 100644 --- a/datafusion-cli/Dockerfile +++ b/datafusion-cli/Dockerfile @@ -25,9 +25,7 @@ WORKDIR /usr/src/datafusion-cli RUN cargo build --release -RUN ls -hal - -FROM debian:buster +FROM debian:buster-slim COPY --from=builder /usr/src/datafusion-cli/target/release/datafusion-cli /usr/local/bin