Skip to content

Commit

Permalink
chore: use compiled cmak for docker build
Browse files Browse the repository at this point in the history
* consider renamed github repository
* use compiled version
* use slim base image
* single place for keeping CMAK version

Resolves #27
Resolves #24
Resolves #22
Resolves #11
  • Loading branch information
eshepelyuk authored and hleb-albau committed Sep 15, 2020
1 parent 20f68fd commit 7e7a22e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 44 deletions.
37 changes: 14 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
FROM openjdk:11-jre as build

### STAGE 1: Build ###
FROM openjdk:11-jdk AS build
ARG CMAK_VERSION="3.0.0.5"

ENV KAFKA_MANAGER_SOURCE=3.0.0.5
ENV KAFKA_MANAGER_VERSION=3.0.0.5
ENV KAFKA_MANAGER_SRC_DIR=/kafka-manager-source
ENV KAFKA_MANAGER_DIST_FILE=$KAFKA_MANAGER_SRC_DIR/target/universal/cmak-$KAFKA_MANAGER_VERSION.zip
RUN curl -L https://github.com/yahoo/CMAK/releases/download/${CMAK_VERSION}/cmak-${CMAK_VERSION}.zip -o /tmp/cmak.zip \
&& unzip /tmp/cmak.zip -d / \
&& ln -s /cmak-$CMAK_VERSION /cmak \
&& rm -rf /tmp/cmak.zip

RUN echo "Building Kafka Manager" \
&& wget "https://github.com/yahoo/CMAK/archive/${KAFKA_MANAGER_SOURCE}.tar.gz" -O CMAK-sources.tar.gz \
&& mkdir $KAFKA_MANAGER_SRC_DIR \
&& tar -xzf CMAK-sources.tar.gz -C $KAFKA_MANAGER_SRC_DIR --strip-components=1 \
&& cd $KAFKA_MANAGER_SRC_DIR \
&& echo 'scalacOptions ++= Seq("-Xmax-classfile-name", "200")' >> build.sbt

ADD robust_build.sh /
RUN chmod +x robust_build.sh && /robust_build.sh

### STAGE 2: Package ###
FROM openjdk:11-jre
FROM openjdk:11-jre-slim
MAINTAINER Hleb Albau <[email protected]>

###RUN apk update && apk add bash
COPY --from=build /kafka-manager-bin /kafka-manager
COPY --from=build /cmak /cmak

VOLUME /cmak/conf

VOLUME /kafka-manager/conf
ENV JAVA_OPTS=-XX:MaxRAMPercentage=80
##CMD ["/kafka-manager/bin/cmak", "-Dpidfile.path=/dev/null", "-Dapplication.home=/kafka-manager"]
ENTRYPOINT ["/kafka-manager/bin/cmak", "-Dpidfile.path=/dev/null", "-Dapplication.home=/kafka-manager", ""]

WORKDIR /cmak

ENTRYPOINT ["/cmak/bin/cmak", "-Dpidfile.path=/dev/null", "-Dapplication.home=/cmak", ""]

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Kafka Manager images come in two flavors:
docker run -d \
-p 9000:9000 \
-e ZK_HOSTS="localhost:2181" \
hlebalbau/kafka-manager:stable \
-Dpidfile.path=/dev/null
hlebalbau/kafka-manager:stable
```

### Using docker-compose
Expand All @@ -33,7 +32,6 @@ services:
environment:
ZK_HOSTS: "zoo:2181"
APPLICATION_SECRET: "random-secret"
command: -Dpidfile.path=/dev/null
```
### In Kubernetes with Kubernetes operator

Expand Down
18 changes: 0 additions & 18 deletions robust_build.sh

This file was deleted.

0 comments on commit 7e7a22e

Please sign in to comment.