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