-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (38 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
40 lines (38 loc) · 1.57 KB
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
ARG BACKREST_VERSION="2.58.0"
ARG DOCKER_BACKREST_VERSION="v0.36"
ARG REPO_BUILD_TAG="unknown"
FROM golang:1.26-bookworm AS builder
ARG REPO_BUILD_TAG
COPY . /build
WORKDIR /build
RUN CGO_ENABLED=0 go build \
-mod=vendor -trimpath \
-ldflags "-s -w \
-X github.com/prometheus/common/version.Version=${REPO_BUILD_TAG} \
-X github.com/prometheus/common/version.BuildDate=$(date +%Y-%m-%dT%H:%M:%S%z) \
-X github.com/prometheus/common/version.Branch=$(git rev-parse --abbrev-ref HEAD) \
-X github.com/prometheus/common/version.Revision=$(git rev-parse --short HEAD) \
-X github.com/prometheus/common/version.BuildUser=pgbackrest_exporter" \
-o pgbackrest_exporter pgbackrest_exporter.go
FROM ghcr.io/woblerr/pgbackrest:${BACKREST_VERSION}-${DOCKER_BACKREST_VERSION}
ARG REPO_BUILD_TAG
ENV EXPORTER_TELEMETRY_PATH="/metrics" \
EXPORTER_PORT="9854" \
EXPORTER_CONFIG="" \
STANZA_INCLUDE="" \
STANZA_EXCLUDE="" \
COLLECT_INTERVAL="600" \
BACKUP_TYPE="" \
VERBOSE_WAL="false" \
DATABASE_COUNT="false" \
DATABASE_PARALLEL_PROCESSES="1" \
DATABASE_COUNT_LATEST="false" \
COLLECTOR_PGBACKREST="true"
COPY --chmod=755 docker_files/run_exporter.sh /run_exporter.sh
COPY --from=builder --chmod=755 /build/pgbackrest_exporter /etc/pgbackrest/pgbackrest_exporter
LABEL \
org.opencontainers.image.version="${REPO_BUILD_TAG}" \
org.opencontainers.image.source="https://github.com/woblerr/pgbackrest_exporter"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/run_exporter.sh"]
EXPOSE ${EXPORTER_PORT}