forked from woblerr/pgbackrest_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (32 loc) · 1.12 KB
/
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
ARG BACKREST_VERSION="2.48"
ARG DOCKER_BACKREST_VERSION="v0.21"
ARG REPO_BUILD_TAG="unknown"
FROM golang:1.20-bookworm AS builder
ARG REPO_BUILD_TAG
COPY . /build
WORKDIR /build
RUN CGO_ENABLED=0 go build \
-mod=vendor -trimpath \
-ldflags "-X main.version=${REPO_BUILD_TAG}" \
-o pgbackrest_exporter pgbackrest_exporter.go
FROM ghcr.io/woblerr/pgbackrest:${BACKREST_VERSION}-${DOCKER_BACKREST_VERSION}
ARG REPO_BUILD_TAG
ENV EXPORTER_ENDPOINT="/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"
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}