From 1c731c81cf7e724ec6a257e97ba7d6b00bd12507 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 19 Jun 2017 07:55:32 +0200 Subject: [PATCH 1/5] wip --- kafka/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kafka/Dockerfile b/kafka/Dockerfile index a888ed5..83ff802 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -1,11 +1,13 @@ -FROM openjdk:8-jre-alpine +FROM gradle:3.5-jdk8-alpine ARG kafka_version=0.11.0.0-rc1 -ENV kafka_bin_version=2.12-$kafka_version RUN apk add --no-cache --update-cache --virtual build-dependencies curl ca-certificates \ && mkdir -p /opt/kafka \ - && curl -SLs "https://www-eu.apache.org/dist/kafka/$kafka_version/kafka_$kafka_bin_version.tgz" | tar -xzf - --strip-components=1 -C /opt/kafka \ + && curl -SLs "https://github.com/apache/kafka/archive/0.11.0.0-rc1.tar.gz" | tar -xzf - --strip-components=1 -C /src/kafka \ + && cd /src/kafka \ + && gradle \ + && gradlew jar \ && apk del build-dependencies \ && rm -rf /var/cache/apk/* From ff20ea9d37796c675dbb2639d3956753c09ffb55 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 23 Jun 2017 06:14:38 +0200 Subject: [PATCH 2/5] wip --- kafka/Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kafka/Dockerfile b/kafka/Dockerfile index 83ff802..efbb052 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -2,14 +2,12 @@ FROM gradle:3.5-jdk8-alpine ARG kafka_version=0.11.0.0-rc1 -RUN apk add --no-cache --update-cache --virtual build-dependencies curl ca-certificates \ - && mkdir -p /opt/kafka \ +RUN mkdir -p /opt/kafka \ && curl -SLs "https://github.com/apache/kafka/archive/0.11.0.0-rc1.tar.gz" | tar -xzf - --strip-components=1 -C /src/kafka \ && cd /src/kafka \ && gradle \ && gradlew jar \ - && apk del build-dependencies \ - && rm -rf /var/cache/apk/* + && ls -la WORKDIR /opt/kafka ENTRYPOINT ["bin/kafka-server-start.sh"] From 4fd319705311abb176cbf596befb1fa86414de7b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 23 Jun 2017 06:44:01 +0200 Subject: [PATCH 3/5] wip, separate layers for faster experiments --- kafka/Dockerfile | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/kafka/Dockerfile b/kafka/Dockerfile index efbb052..4abdbde 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -1,15 +1,27 @@ -FROM gradle:3.5-jdk8-alpine +FROM openjdk:8u131-jre-alpine -ARG kafka_version=0.11.0.0-rc1 +ENV KAFKA_VERSION=0.11.0.0-rc2 -RUN mkdir -p /opt/kafka \ - && curl -SLs "https://github.com/apache/kafka/archive/0.11.0.0-rc1.tar.gz" | tar -xzf - --strip-components=1 -C /src/kafka \ - && cd /src/kafka \ - && gradle \ - && gradlew jar \ - && ls -la +RUN set -e; cd /usr/local; \ + GRADLE_VERSION=4.0 PATH=$PATH:$(pwd)/gradle-$GRADLE_VERSION/bin; \ + apk add --no-cache curl; \ + curl -SLs -o gradle-$GRADLE_VERSION-bin.zip https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip; \ + unzip gradle-$GRADLE_VERSION-bin.zip; \ + rm gradle-$GRADLE_VERSION-bin.zip; \ + gradle -v; \ + \ + gradle -WORKDIR /opt/kafka +RUN set -e; cd /usr/local; \ + export PATH=$PATH:/usr/local/gradle-4.0/bin; \ + mkdir kafka-build; \ + curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./kafka-build; \ + cd kafka-build; \ + ls -la + +RUN mkdir -p /usr/local/kafka/config && touch /usr/local/kafka/config/server.properties + +WORKDIR /usr/local/kafka ENTRYPOINT ["bin/kafka-server-start.sh"] RUN sed -i 's/zookeeper.connect=localhost:2181/zookeeper.connect=zookeeper:2181/' config/server.properties From fc93d211dd4208ae16b12f250c2197ccb4d9135b Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 23 Jun 2017 07:00:17 +0200 Subject: [PATCH 4/5] Builds with latest scala, and quite a lot of warnings --- kafka/Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kafka/Dockerfile b/kafka/Dockerfile index 4abdbde..1fdce20 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -1,23 +1,24 @@ FROM openjdk:8u131-jre-alpine -ENV KAFKA_VERSION=0.11.0.0-rc2 +ENV KAFKA_VERSION=0.11.0.0-rc2 SCALA_VERSION=2.12.2 RUN set -e; cd /usr/local; \ GRADLE_VERSION=4.0 PATH=$PATH:$(pwd)/gradle-$GRADLE_VERSION/bin; \ - apk add --no-cache curl; \ + apk add --no-cache curl openjdk8="$JAVA_ALPINE_VERSION"; \ curl -SLs -o gradle-$GRADLE_VERSION-bin.zip https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip; \ unzip gradle-$GRADLE_VERSION-bin.zip; \ rm gradle-$GRADLE_VERSION-bin.zip; \ - gradle -v; \ - \ - gradle + gradle -v; RUN set -e; cd /usr/local; \ export PATH=$PATH:/usr/local/gradle-4.0/bin; \ - mkdir kafka-build; \ - curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./kafka-build; \ - cd kafka-build; \ - ls -la + mkdir build-kafka; \ + curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./build-kafka; \ + cd build-kafka; \ + sed -i "s/scalaVersion=.*/scalaVersion=$SCALA_VERSION/" gradle.properties; \ + gradle; \ + #./gradlew test; \ + ./gradlew jar RUN mkdir -p /usr/local/kafka/config && touch /usr/local/kafka/config/server.properties From 6c1a656dbac3bc0c49c99a9739e9af8a1ae7c9f3 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Fri, 23 Jun 2017 15:26:53 +0200 Subject: [PATCH 5/5] Keep all sources, for now util we do they layer cleanup, and install bash for the bin scripts --- kafka/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kafka/Dockerfile b/kafka/Dockerfile index 1fdce20..c47a578 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -12,15 +12,15 @@ RUN set -e; cd /usr/local; \ RUN set -e; cd /usr/local; \ export PATH=$PATH:/usr/local/gradle-4.0/bin; \ - mkdir build-kafka; \ - curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./build-kafka; \ - cd build-kafka; \ + mkdir kafka; \ + curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./kafka; \ + cd kafka; \ sed -i "s/scalaVersion=.*/scalaVersion=$SCALA_VERSION/" gradle.properties; \ gradle; \ - #./gradlew test; \ + ./gradlew test; \ ./gradlew jar -RUN mkdir -p /usr/local/kafka/config && touch /usr/local/kafka/config/server.properties +RUN apk add --no-cache bash WORKDIR /usr/local/kafka ENTRYPOINT ["bin/kafka-server-start.sh"]