From ee9a02910a3d3d260b4f5570ca31e9f9aa78a7e9 Mon Sep 17 00:00:00 2001 From: c93614 <186645+c93614@users.noreply.github.com> Date: Fri, 21 May 2021 12:34:45 +0800 Subject: [PATCH] Use docker multi-stage build to reduce the docker image size --- Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 12c49796d9..8a8e104382 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ - FROM centos:7 + FROM centos:7 as builder LABEL maintainer="SvenDowideit@home.org.au, zhangshaomin_1990@126.com" @@ -34,7 +34,16 @@ RUN rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm && yum -y remove git && \ yum -y clean all +FROM centos:7 +ENV PIKA /pika +ENV PATH ${PIKA}:${PIKA}/bin:${PATH} + +RUN set -eux; yum install -y epel-release; \ + yum install -y snappy protobuf gflags glog bzip2 zlib lz4 libzstd rsync; \ + yum clean all; + WORKDIR ${PIKA} +COPY --from=builder $PIKA ./ ENTRYPOINT ["/pika/entrypoint.sh"] CMD ["/pika/bin/pika", "-c", "/pika/conf/pika.conf"]