-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (17 loc) · 888 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (17 loc) · 888 Bytes
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
FROM rust:1-alpine3.22 AS builder
ARG BUILD_ENVIRONMENT
WORKDIR /app/
RUN apk add --no-cache musl-dev openssl-dev
COPY Cargo.lock Cargo.toml ./
COPY src/ src/
RUN echo "$BUILD_ENVIRONMENT" > .env && cargo install --path .
FROM alpine:3.22 AS docker-prometheus-exporter
WORKDIR /app
LABEL org.opencontainers.image.source="https://github.com/Calum4/docker-prometheus-exporter"
LABEL org.opencontainers.image.description="Exports basic metrics from Docker for scraping by Prometheus"
LABEL org.opencontainers.image.licenses="MIT OR Apache2"
RUN apk add --no-cache curl
COPY --from=builder /usr/local/cargo/bin/docker-prometheus-exporter docker-prometheus-exporter
HEALTHCHECK --interval=15s --timeout=1s --retries=10 --start-period=15s \
CMD curl -sSf -o /dev/null "http://${LISTEN_ADDR:-127.0.0.1}:${LISTEN_PORT:-9000}/ping" || exit 1
CMD ["/app/docker-prometheus-exporter"]