diff --git a/kafka-prometheus-jmx-exporter/Dockerfile b/kafka-prometheus-jmx-exporter/Dockerfile new file mode 100644 index 0000000..5df3ba2 --- /dev/null +++ b/kafka-prometheus-jmx-exporter/Dockerfile @@ -0,0 +1,25 @@ +FROM openjdk:8u131-jre-alpine + +ENV EXPORTER_VERSION=8ded2c5e112f8c458e60398c528799ca763c78ac + +RUN set -e; cd /usr/local; \ + MAVEN_VERSION=3.5.0 PATH=$PATH:$(pwd)/maven/bin; \ + apk add --no-cache --virtual .build-deps \ + curl \ + openjdk8="$JAVA_ALPINE_VERSION"; \ + mkdir ./maven; \ + curl -SLs https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzf - --strip-components=1 -C ./maven; \ + mvn --version; \ + \ + mkdir ./jmx_exporter; \ + curl -SLs https://github.com/prometheus/jmx_exporter/archive/$EXPORTER_VERSION.tar.gz | tar -xzf - --strip-components=1 -C ./jmx_exporter; \ + cd ./jmx_exporter; \ + mvn package; \ + \ + rm /root/.m2 -Rf; \ + apk del .build-deps; + +RUN apk add --no-cache bash + +WORKDIR /usr/local/jmx_exporter +ENTRYPOINT ["run_sample_httpserver.sh"] diff --git a/kafka/Dockerfile b/kafka/Dockerfile index 4d43b54..70e8e14 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -1,16 +1,52 @@ -FROM openjdk:8-jre-alpine +FROM openjdk:8u131-jre-alpine -ARG kafka_version=0.10.2.0 -ENV kafka_bin_version=2.12-$kafka_version +ENV KAFKA_VERSION=0.11.0.0 SCALA_VERSION=2.12.2 -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 \ - && apk del build-dependencies \ - && rm -rf /var/cache/apk/* +RUN set -e; cd /usr/local; \ + GRADLE_VERSION=4.0 PATH=$PATH:$(pwd)/gradle-$GRADLE_VERSION/bin; \ + apk add --no-cache --virtual .build-deps \ + 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; \ + \ + mkdir build; \ + curl -SLs "https://github.com/apache/kafka/archive/$KAFKA_VERSION.tar.gz" | tar -xzf - --strip-components=1 -C ./build; \ + cd build; \ + sed -i "s/scalaVersion=.*/scalaVersion=$SCALA_VERSION/" gradle.properties; \ + gradle; \ + #./gradlew unitTest; \ + #./gradlew integrationTest; \ + ./gradlew jar; \ + gradle --stop; \ + cd ..; \ + \ + rm gradle-$GRADLE_VERSION -Rf; \ + rm ~/.gradle -Rf; \ + apk del .build-deps; \ + \ + mkdir -p kafka/core/build kafka/clients/build; \ + mv build/core/build/libs kafka/core/build/; \ + mv build/core/build/dependant-libs-* kafka/core/build/; \ + mv build/clients/build/libs kafka/clients/build/; \ + mv build/config kafka/; \ + mv build/bin kafka/; \ + rm kafka/bin/windows -Rf; \ + rm build -Rf -WORKDIR /opt/kafka +RUN apk add --no-cache bash + +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 CMD ["config/server.properties"] + +RUN set -e; \ + mv config/log4j.properties config/log4j.properties.org; \ + echo "log4j.rootLogger=INFO, stdout" > config/log4j.properties; \ + echo "log4j.appender.stdout=org.apache.log4j.ConsoleAppender" >> config/log4j.properties; \ + echo "log4j.appender.stdout.layout=org.apache.log4j.PatternLayout" >> config/log4j.properties; \ + echo "log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n" >> config/log4j.properties