forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## | ||
# Copyright 2023 Aiven Oy | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
## | ||
# Kafka 3.4.x | ||
FROM confluentinc/cp-kafka:7.4.0 | ||
|
||
ARG _SCALA_VERSION | ||
ARG _KAFKA_VERSION | ||
ENV _KAFKA_FULL_VERSION "kafka_${_SCALA_VERSION}-${_KAFKA_VERSION}" | ||
|
||
USER root | ||
COPY core/build/distributions/${_KAFKA_FULL_VERSION}.tgz / | ||
RUN cd / \ | ||
&& tar -xf ${_KAFKA_FULL_VERSION}.tgz \ | ||
&& rm -r /usr/share/java/kafka/* \ | ||
&& cp /${_KAFKA_FULL_VERSION}/libs/* /usr/share/java/kafka/ \ | ||
&& ln -s /usr/share/java/kafka/${_KAFKA_FULL_VERSION}.jar /usr/share/java/kafka/kafka.jar \ | ||
&& rm -r /${_KAFKA_FULL_VERSION}.tgz /${_KAFKA_FULL_VERSION} | ||
|
||
# Add test jars with local implementations. | ||
COPY clients/build/libs/kafka-clients-${_KAFKA_VERSION}-test.jar /usr/share/java/kafka/ | ||
COPY storage/build/libs/kafka-storage-${_KAFKA_VERSION}-test.jar /usr/share/java/kafka/ | ||
COPY storage/api/build/libs/kafka-storage-api-${_KAFKA_VERSION}-test.jar /usr/share/java/kafka/ | ||
|
||
# Restore the user. | ||
USER appuser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## | ||
# Copyright 2023 Aiven Oy | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
## | ||
SCALA_VERSION := $(shell grep -o -E '^scalaVersion=[0-9]+\.[0-9]+\.[0-9]+' gradle.properties | cut -c14-) | ||
SCALA_MAJOR_VERSION := $(shell grep -o -E '^scalaVersion=[0-9]+\.[0-9]+' gradle.properties | cut -c14-) | ||
KAFKA_VERSION := $(shell grep -o -E '^version=[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?' gradle.properties | cut -c9-) | ||
IMAGE_NAME=aivenoy/kafka | ||
|
||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
IMAGE_TAG := $(subst /,_,$(BRANCH)) | ||
|
||
.PHONY: all build clean | ||
|
||
all: clean build | ||
|
||
clean: | ||
./gradlew clean | ||
|
||
build: core/build/distributions/kafka_$(SCALA_VERSION)-$(KAFKA_VERSION).tgz | ||
|
||
core/build/distributions/kafka_$(SCALA_VERSION)-$(KAFKA_VERSION).tgz: | ||
echo "Version: $(KAFKA_VERSION)-$(SCALA_VERSION)" | ||
./gradlew -PscalaVersion=$(SCALA_VERSION) testJar releaseTarGz | ||
|
||
.PHONY: docker_image | ||
docker_image: build | ||
docker build . \ | ||
--build-arg _SCALA_VERSION=$(SCALA_MAJOR_VERSION) \ | ||
--build-arg _KAFKA_VERSION=$(KAFKA_VERSION) \ | ||
-t $(IMAGE_NAME):$(IMAGE_TAG) | ||
|
||
.PHONY: docker_push | ||
docker_push: | ||
docker push $(IMAGE_NAME):$(IMAGE_TAG) | ||
|
||
# TODO publish docker images |