diff --git a/.github/actions/build-postfix-exporter/action.yaml b/.github/actions/build-postfix-exporter/action.yaml index 8e7fecf..ebea620 100644 --- a/.github/actions/build-postfix-exporter/action.yaml +++ b/.github/actions/build-postfix-exporter/action.yaml @@ -19,9 +19,9 @@ runs: - name: Checkout uses: actions/checkout@v4 with: - repository: Hsn723/postfix_exporter # Hsn723 repo is actually being updated + repository: kumina/postfix_exporter path: 'postfix_exporter' - ref: 'v0.7.0' # Latest commit we know that works + ref: 'a6f58e9b2b2b4decc7e65c5a34b4fd53cd6665f1' # Latest commit we know that works - name: Apply patches shell: bash @@ -68,11 +68,7 @@ runs: push: true tags: '${{ inputs.tags }}' labels: ${{ steps.meta.outputs.labels }} - # linux/arm/v5 and linux/arm/v6 are not supported anymore by upstream Go docker images. - # Technically, we could build them but we would need to bootstrap the whole Go compiler. - # However, I'm not sure if it's worth it. - platforms: "linux/amd64,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x" - # linux/386,linux/arm/v6,linux/arm64,linux/riscv64" + platforms: "linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x" cache-from: type=local,src=/tmp/.buildx-cache/postfix-exporter,mode=max,compression=estargz cache-to: type=local,dest=/tmp/.buildx-cache-new/postfix-exporter diff --git a/README.md b/README.md index dce43a8..d2f081c 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ Several potentially "surprising" changes went into this issue and hence warrant - **[`master`](https://github.com/bokysan/docker-postfix/tree/master/) branch now builds images called [`edge`](https://hub.docker.com/r/boky/postfix/tags?page=1&name=edge)**. `latest` images are built from the last tag. We've had several issues with people using the `latest` tag and reporting problems. You can now rely on `latest` being the latest stable release. -- Image now builds its own version of [postfix-exporter](https://github.com/hsn723/postfix_exporter) and relies on this +- Image now builds its own version of [postfix-exporter](https://github.com/kumina/postfix_exporter) and relies on this third-party project. Checkout is from master branch, based on specific SHA commit id. The same hash is used for master and tags. - **Architecture galore!** With the addition of debian images, we now support support more architectures than ever. The list includes: diff --git a/postfix-exporter-01.patch b/postfix-exporter-01.patch index fec06e0..4b312ae 100644 --- a/postfix-exporter-01.patch +++ b/postfix-exporter-01.patch @@ -1,34 +1,25 @@ diff --git a/Dockerfile b/Dockerfile -index 75a22d8..81145c9 100644 +index a3327d8..1cdfa84 100644 --- a/Dockerfile +++ b/Dockerfile -@@ -1,8 +1,41 @@ --FROM scratch +@@ -1,4 +1,10 @@ +-FROM golang:1.16 AS builder +# syntax=docker/dockerfile:1.2 -+FROM golang:1.23 AS builder - LABEL org.opencontainers.image.source="https://github.com/hsn723/postfix_exporter" \ - org.opencontainers.image.authors="Hsn723" \ - org.opencontainers.image.title="postfix_exporter" ++FROM golang:1.21.3-bookworm AS builder +ARG TARGETPLATFORM +ARG TARGETOS +ARG TARGETARCH +ARG TARGETVARIANT + -+WORKDIR /src -+ -+# avoid downloading the dependencies on successive builds -+RUN apt-get update -qq && apt-get install -qqy \ -+ build-essential \ -+ libsystemd-dev -+ -+COPY go.mod go.sum ./ -+RUN go mod download -+RUN go mod verify -+ -+COPY . . -+ -+# Force the go compiler to use modules -+ENV GO111MODULE=on + WORKDIR /src + + # avoid downloading the dependencies on succesive builds +@@ -14,10 +20,18 @@ COPY . . + + # Force the go compiler to use modules + ENV GO111MODULE=on +-RUN go test +-RUN go build -o /bin/postfix_exporter +# go test fails (sometimes) because it relies on an external dependency: +# +# warning: SASL authentication failure: cannot connect to saslauthd server: Permission denied @@ -39,12 +30,10 @@ index 75a22d8..81145c9 100644 +# Hence disabling the test here. +# RUN go test +RUN env GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" GOARM="$( echo "$TARGETVARIANT" | grep -E -o "\\d+$")" go build -ldflags '-extldflags "-static"' -o /bin/postfix_exporter -+ + +-FROM debian:latest +FROM scratch EXPOSE 9154 --COPY postfix_exporter / --COPY LICENSE / --ENTRYPOINT ["/postfix_exporter"] -+WORKDIR / -+COPY --from=builder /bin/postfix_exporter /bin/ -+ENTRYPOINT ["/bin/postfix_exporter"] + WORKDIR / + COPY --from=builder /bin/postfix_exporter /bin/ + \ No newline at end of file