Skip to content
Permalink
Browse files
Use Build Kit docker feature to shrink the Docker image size (#3669)
  • Loading branch information
nicknezis committed Jan 27, 2021
1 parent b161317 commit a51c822951aaccc381c2f2fdc9973003a5be7a09
Showing 20 changed files with 54 additions and 316 deletions.
@@ -51,7 +51,8 @@ ENV bazelVersion 3.7.2

RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
&& chmod +x /tmp/bazel.sh \
&& /tmp/bazel.sh
&& /tmp/bazel.sh \
&& rm -rf /tmp/bazel.sh

ADD bazelrc /root/.bazelrc
ADD scripts/compile-platform.sh /compile-platform.sh
@@ -47,7 +47,8 @@ ENV bazelVersion 3.7.2

RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
&& chmod +x /tmp/bazel.sh \
&& /tmp/bazel.sh
&& /tmp/bazel.sh \
&& rm -rf /tmp/bazel.sh

ADD bazelrc /root/.bazelrc
ADD scripts/compile-platform.sh /compile-platform.sh

This file was deleted.

@@ -48,7 +48,8 @@ ENV bazelVersion 3.7.2

RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
&& chmod +x /tmp/bazel.sh \
&& /tmp/bazel.sh
&& /tmp/bazel.sh \
&& rm -rf /tmp/bazel.sh

ADD bazelrc /root/.bazelrc
ADD scripts/compile-platform.sh /compile-platform.sh
@@ -49,7 +49,8 @@ ENV bazelVersion 3.7.2

RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
&& chmod +x /tmp/bazel.sh \
&& /tmp/bazel.sh
&& /tmp/bazel.sh \
&& rm -rf /tmp/bazel.sh

ADD bazelrc /root/.bazelrc
ADD scripts/compile-platform.sh /compile-platform.sh
@@ -15,12 +15,12 @@
# specific language governing permissions and limitations
# under the License.

#syntax=docker/dockerfile:1.2
FROM centos:centos7

ENV LC_ALL en_US.utf8

RUN yum -y install epel-release \
&& yum -y update \
&& yum -y install \
curl \
java-11-openjdk-headless \
@@ -34,14 +34,12 @@ RUN yum -y install epel-release \

ENV JAVA_HOME /usr/

ADD artifacts /heron
# run Heron installer
RUN --mount=type=bind,source=artifacts,target=/tmp/heron /tmp/heron/heron-install.sh \
&& rm -f /usr/local/heron/dist/heron-core.tar.gz

WORKDIR /heron

# run heron installer
RUN /heron/heron-install.sh \
&& rm -f /heron/heron-install.sh

RUN ln -s /usr/local/heron/dist/heron-core /heron \
&& mkdir -p /heron/heron-tools \
&& ln -s /usr/local/heron/bin /heron/heron-tools \
@@ -55,11 +53,10 @@ RUN ln -s /usr/local/heron/dist/heron-core /heron \
ENV HERON_HOME /heron/heron-core/
RUN export HERON_HOME

# install zookeeper
# install Zookeeper
ARG ZK_DIST=zookeeper-3.5.8
ADD dist/scripts /opt/heron-docker/scripts

RUN sh /opt/heron-docker/scripts/install-zookeeper.sh $ZK_DIST
RUN --mount=type=bind,source=dist,target=/opt/heron-docker/ sh /opt/heron-docker/scripts/install-zookeeper.sh $ZK_DIST

ADD dist/conf/zookeeper.conf /opt/zookeeper/conf/zookeeper.conf
ADD dist/conf/sandbox.conf /etc/supervisor/conf.d/
@@ -15,8 +15,12 @@
# specific language governing permissions and limitations
# under the License.

#syntax=docker/dockerfile:1.2
FROM openjdk:11-jdk-slim-buster

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

RUN apt-get update \
&& apt-get -y install \
curl \
@@ -27,17 +31,12 @@ RUN apt-get update \
unzip \
&& apt-get clean

ADD artifacts /heron
# run Heron installer
RUN --mount=type=bind,source=artifacts,target=/tmp/heron /tmp/heron/heron-install.sh \
&& rm -f /usr/local/heron/dist/heron-core.tar.gz

WORKDIR /heron

# run heron installer
RUN /heron/heron-install.sh && \
rm -rf /heron/heron-install.sh && \
rm -rf /opt/heron/heron-core/lib/scheduler/heron-local-scheduler.jar && \
rm -rf /opt/heron/heron-core/lib/scheduler/heron-mesos-scheduler.jar && \
rm -rf /opt/heron/heron-core/lib/scheduler/heron-slurm-scheduler.jar

RUN ln -s /usr/local/heron/dist/heron-core /heron \
&& mkdir -p /heron/heron-tools \
&& ln -s /usr/local/heron/bin /heron/heron-tools \
@@ -51,14 +50,11 @@ RUN ln -s /usr/local/heron/dist/heron-core /heron \
ENV HERON_HOME /heron/heron-core/
RUN export HERON_HOME

# install zookeeper
# install Zookeeper
ARG ZK_DIST=zookeeper-3.5.8
ADD dist/scripts /opt/heron-docker/scripts

RUN sh /opt/heron-docker/scripts/install-zookeeper.sh $ZK_DIST
RUN --mount=type=bind,source=dist,target=/opt/heron-docker/ sh /opt/heron-docker/scripts/install-zookeeper.sh $ZK_DIST

ADD dist/conf/zookeeper.conf /opt/zookeeper/conf/zookeeper.conf
ADD dist/conf/sandbox.conf /etc/supervisor/conf.d/

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a51c822

Please sign in to comment.