From 2767af95b57831d0882d80e47566a452261a72b0 Mon Sep 17 00:00:00 2001 From: David Lorite Date: Tue, 14 Jul 2020 09:20:36 +0200 Subject: [PATCH] Add dockerfile and entrypoint --- Dockerfile | 7 +++++++ entrypoint.sh | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2f9ebd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM openjdk:11-jre-slim-buster +ARG EXPORTER_VERSION=0.9.10 +RUN mkdir -p /opt/cassandra_exporter +ADD https://github.com/instaclustr/cassandra-exporter/releases/download/v${EXPORTER_VERSION}/cassandra-exporter-standalone-${EXPORTER_VERSION}.jar /opt/cassandra_exporter/cassandra_exporter.jar +COPY ./entrypoint.sh /opt/cassandra_exporter/entrypoint.sh +RUN chmod g+wrX,o+rX -R /opt/cassandra_exporter +CMD sh /opt/cassandra_exporter/entrypoint.sh \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3c12ee8 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#/bin/sh +if [ -z ${CASSANDRA_EXPORTER_USER} ] && [ -z ${CASSANDRA_EXPORTER_PASSWORD} ]; then + java -jar /opt/cassandra_exporter/cassandra_exporter.jar +else + java -jar /opt/cassandra_exporter/cassandra_exporter.jar --jmx-user=CASSANDRA_EXPORTER_USER --jmx-password=CASSANDRA_EXPORTER_PASSWORD --table-labels=TABLE_TYPE --global-labels=CLUSTER,NODE +fi \ No newline at end of file