Skip to content

Commit

Permalink
[COMMON] use pre-built image to reduce the image size
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Apr 14, 2024
1 parent fffa17a commit ddc2f0f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 34 deletions.
3 changes: 1 addition & 2 deletions docker/build_deps_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ declare -r DOCKERFILE=$DOCKER_FOLDER/deps.dockerfile
# ===================================[functions]===================================
function generateDockerfile() {
echo "# this dockerfile is generated dynamically
FROM ubuntu:23.10
FROM azul/zulu-openjdk:21
# install tools
RUN apt-get update && apt-get install -y \
git \
openjdk-21-jdk \
wget \
unzip \
curl
Expand Down
5 changes: 1 addition & 4 deletions docker/start_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ RUN ./gradlew clean build -x test --no-daemon
RUN mkdir /opt/astraea
RUN tar -xvf \$(find ./app/build/distributions/ -maxdepth 1 -type f -name app-*.tar) -C /opt/astraea/ --strip-components=1
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy astraea
COPY --from=build /opt/astraea /opt/astraea
Expand Down
10 changes: 2 additions & 8 deletions docker/start_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ RUN ./gradlew clean releaseTarGz
RUN mkdir /opt/kafka
RUN tar -zxvf \$(find ./core/build/distributions/ -maxdepth 1 -type f \( -iname \"kafka*tgz\" ! -iname \"*sit*\" \)) -C /opt/kafka --strip-components=1
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/jmx_exporter /opt/jmx_exporter
Expand Down Expand Up @@ -133,10 +130,7 @@ RUN mkdir /opt/kafka
RUN tar -zxvf kafka_2.13-${VERSION}.tgz -C /opt/kafka --strip-components=1
WORKDIR /opt/kafka
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/jmx_exporter /opt/jmx_exporter
Expand Down
10 changes: 2 additions & 8 deletions docker/start_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ RUN ./gradlew clean releaseTarGz
RUN mkdir /opt/kafka
RUN tar -zxvf \$(find ./core/build/distributions/ -maxdepth 1 -type f \( -iname \"kafka*tgz\" ! -iname \"*sit*\" \)) -C /opt/kafka --strip-components=1
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/jmx_exporter /opt/jmx_exporter
Expand Down Expand Up @@ -119,10 +116,7 @@ RUN mkdir /opt/kafka
RUN tar -zxvf kafka_2.13-${VERSION}.tgz -C /opt/kafka --strip-components=1
WORKDIR /opt/kafka
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/jmx_exporter /opt/jmx_exporter
Expand Down
10 changes: 2 additions & 8 deletions docker/start_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ WORKDIR /tmp/astraea
RUN ./gradlew clean shadowJar
RUN cp /tmp/astraea/connector/build/libs/astraea-*-all.jar /opt/kafka/libs/
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/kafka /opt/kafka
Expand Down Expand Up @@ -132,10 +129,7 @@ WORKDIR /tmp/astraea
RUN ./gradlew clean shadowJar
RUN cp /tmp/astraea/connector/build/libs/astraea-*-all.jar /opt/kafka/libs/
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy kafka
COPY --from=build /opt/kafka /opt/kafka
Expand Down
5 changes: 1 addition & 4 deletions docker/start_zookeeper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ RUN wget https://archive.apache.org/dist/zookeeper/zookeeper-${VERSION}/apache-z
RUN mkdir /opt/zookeeper
RUN tar -zxvf apache-zookeeper-${VERSION}-bin.tar.gz -C /opt/zookeeper --strip-components=1
FROM ubuntu:23.10
# install tools
RUN apt-get update && apt-get install -y openjdk-21-jre
FROM azul/zulu-openjdk:21-jre
# copy zookeeper
COPY --from=build /opt/zookeeper /opt/zookeeper
Expand Down

0 comments on commit ddc2f0f

Please sign in to comment.