-
Notifications
You must be signed in to change notification settings - Fork 0
/
prometheus-mosquitto-exporter.debian.Dockerfile
52 lines (37 loc) · 2.13 KB
/
prometheus-mosquitto-exporter.debian.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# docker build --no-cache --progress=plain -t tobi312/tools:prometheus-mosquitto-exporter -f prometheus-mosquitto-exporter.debian.Dockerfile .
FROM rust:1.73-slim-bookworm AS builder
ARG VERSION=master
ENV RUST_BACKTRACE=1
RUN apt update && apt install -y pkg-config libssl-dev cmake git
WORKDIR /usr/src/
RUN git clone --branch ${VERSION} --single-branch https://git.ypbind.de/repository/prometheus-mosquitto-exporter.git prometheus-mosquitto-exporter
WORKDIR /usr/src/prometheus-mosquitto-exporter
#COPY . .
RUN cargo build --release ; \
ls -lah /usr/src/prometheus-mosquitto-exporter/target/release
FROM debian:bookworm-slim
ARG VCS_REF
ARG BUILD_DATE
ARG VERSION
LABEL org.opencontainers.image.title="prometheus-mosquitto-exporter" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.description="Export statistics of Mosquitto MQTT broker (topic: \$SYS) to Prometheus" \
org.opencontainers.image.documentation="https://ypbind.de/maus/projects/prometheus-mosquitto-exporter/" \
org.opencontainers.image.base.name="docker.io/library/debian:bookworm-slim" \
org.opencontainers.image.licenses="GPL-3.0" \
org.opencontainers.image.url="https://github.com/Tob1as/docker-tools" \
org.opencontainers.image.source="https://git.ypbind.de/cgit/prometheus-mosquitto-exporter/"
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN apt-get update && apt-get install -y ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/* ; \
mkdir -p /etc/prometheus-mosquitto-exporter/
# binary
COPY --from=builder --chown=nobody:nogroup /usr/src/prometheus-mosquitto-exporter/target/release/prometheus-mosquitto-exporter /usr/local/bin/prometheus-mosquitto-exporter
# example
COPY --from=builder --chown=nobody:nogroup /usr/src/prometheus-mosquitto-exporter/etc/prometheus-mosquitto-exporter.yaml /etc/prometheus-mosquitto-exporter/config.yaml
USER nobody
#EXPOSE 6883/tcp 9883/tcp
ENTRYPOINT ["prometheus-mosquitto-exporter"]
#CMD ["--help"]
CMD ["--config=/etc/prometheus-mosquitto-exporter/config.yaml"]