Skip to content

Commit

Permalink
[DOCKER] enable to run kafka on rc release
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Oct 27, 2024
1 parent b9ce6cb commit dbb0f77
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
12 changes: 9 additions & 3 deletions docker/start_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ WORKDIR /opt/kafka
}

function generateDockerfileByVersion() {
local kafka_url="https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
local version=$KAFKA_VERSION
if [[ "$KAFKA_VERSION" == *"rc"* ]]; then
## `3.8.1-rc1` the rc release does not exist in archive repo
version=${KAFKA_VERSION%-*}
kafka_url="https://dist.apache.org/repos/dist/dev/kafka/${KAFKA_VERSION}/kafka_2.13-${version}.tgz"
fi
echo "# this dockerfile is generated dynamically
FROM ubuntu:23.10 AS build
Expand All @@ -135,10 +142,9 @@ RUN wget https://REPO1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaage
# download kafka
WORKDIR /tmp
RUN wget https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz
RUN wget $kafka_url
RUN mkdir /opt/kafka
RUN tar -zxvf kafka_2.13-${KAFKA_VERSION}.tgz -C /opt/kafka --strip-components=1
WORKDIR /opt/kafka
RUN tar -zxvf kafka_2.13-${version}.tgz -C /opt/kafka --strip-components=1
FROM azul/zulu-openjdk:21-jre
Expand Down
12 changes: 9 additions & 3 deletions docker/start_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ WORKDIR /opt/kafka
}

function generateDockerfileByVersion() {
local kafka_url="https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
local version=$KAFKA_VERSION
if [[ "$KAFKA_VERSION" == *"rc"* ]]; then
## `3.8.1-rc1` the rc release does not exist in archive repo
version=${KAFKA_VERSION%-*}
kafka_url="https://dist.apache.org/repos/dist/dev/kafka/${KAFKA_VERSION}/kafka_2.13-${version}.tgz"
fi
echo "# this dockerfile is generated dynamically
FROM ubuntu:23.10 AS build
Expand All @@ -135,10 +142,9 @@ RUN wget https://REPO1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaage
# download kafka
WORKDIR /tmp
RUN wget https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz
RUN wget $kafka_url
RUN mkdir /opt/kafka
RUN tar -zxvf kafka_2.13-${KAFKA_VERSION}.tgz -C /opt/kafka --strip-components=1
WORKDIR /opt/kafka
RUN tar -zxvf kafka_2.13-${version}.tgz -C /opt/kafka --strip-components=1
FROM azul/zulu-openjdk:21-jre
Expand Down
12 changes: 9 additions & 3 deletions docker/start_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,22 @@ WORKDIR /opt/kafka
}

function generateDockerfileByVersion() {
local repo="https://github.com/${ACCOUNT}/astraea"
local kafka_url="https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_2.13-${KAFKA_VERSION}.tgz"
local version=$KAFKA_VERSION
if [[ "$KAFKA_VERSION" == *"rc"* ]]; then
## `3.8.1-rc1` the rc release does not exist in archive repo
version=${KAFKA_VERSION%-*}
kafka_url="https://dist.apache.org/repos/dist/dev/kafka/${KAFKA_VERSION}/kafka_2.13-${version}.tgz"
fi
echo "# this dockerfile is generated dynamically
FROM ghcr.io/opensource4you/astraea/deps AS build
FROM ubuntu:23.10 AS build
# install tools
RUN apt-get update && apt-get install -y wget
# download kafka
WORKDIR /tmp
RUN wget https://archive.apache.org/dist/kafka/${VERSION}/kafka_2.13-${VERSION}.tgz
RUN wget $kafka_url
RUN mkdir /opt/kafka
RUN tar -zxvf kafka_2.13-${VERSION}.tgz -C /opt/kafka --strip-components=1
RUN git clone ${repo} /tmp/astraea
Expand Down

0 comments on commit dbb0f77

Please sign in to comment.