Compare commits

...

4 commits

Author SHA1 Message Date
Bojan Čekrlić
a99abca165 Fix: disable building postfix-expoter for ppc64le and s390x
Builds fail:

```
[linux/s390x builder 8/8] RUN env GOOS="linux" GOARCH="s390x" GOARM="$( echo "" | grep -E -o "\d+$")" go build -ldflags '-extldflags "-static"'  -o /bin/postfix_exporter
606.1 net: gcc: signal: segmentation fault (core dumped)
...
```

```
[linux/ppc64le builder 8/8] RUN env GOOS="linux" GOARCH="ppc64le" GOARM="$( echo "" | grep -E -o "\d+$")" go build -ldflags '-extldflags "-static"'  -o /bin/postfix_exporter
ERROR: process "/bin/sh -c env GOOS=\"${TARGETOS}\" GOARCH=\"${TARGETARCH}\" GOARM=\"$( echo \"$TARGETVARIANT\" | grep -E -o \"\\\\d+$\")\" go build -ldflags '-extldflags \"-static\"'  -o /bin/postfix_exporter" did not complete successfully: exit code: 1
gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
```
2025-01-31 08:47:47 +01:00
Bojan Čekrlić
6b6d67eeac Fix: Rollback to kumina/postfix_exporter 2025-01-31 07:45:23 +01:00
Bojan Čekrlić
3fc96164b2 Fix: Rollback sals plugin to 0.25 2025-01-31 07:31:59 +01:00
Bojan Čekrlić
b359a946bf Fix: Remove linux/arm/v6 from build of postfix-exporter 2025-01-31 07:26:42 +01:00
4 changed files with 25 additions and 36 deletions

View file

@ -19,9 +19,9 @@ runs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: Hsn723/postfix_exporter # Hsn723 repo is actually being updated repository: kumina/postfix_exporter
path: '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 - name: Apply patches
shell: bash shell: bash
@ -68,8 +68,8 @@ runs:
push: true push: true
tags: '${{ inputs.tags }}' tags: '${{ inputs.tags }}'
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
platforms: "linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x" platforms: "linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le"
# 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-from: type=local,src=/tmp/.buildx-cache/postfix-exporter,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/postfix-exporter cache-to: type=local,dest=/tmp/.buildx-cache-new/postfix-exporter

View file

@ -7,7 +7,7 @@
# #
# - use Alpine if you're strapped for space. But beware it uses MUSL LIBC, so unicode support might be an issue. # - use Alpine if you're strapped for space. But beware it uses MUSL LIBC, so unicode support might be an issue.
# - use Debian if you're interested in the greatest cross-platform compatibility. It is larger than Alpine, though. # - use Debian if you're interested in the greatest cross-platform compatibility. It is larger than Alpine, though.
# - use Ubuntu if, well, Ubuntu is your thing and you're used to Ubuntu ecosystem. # - use Ubuntu if, well, Ubuntu is your thing and you're used to the buntu ecosystem.
ARG BASE_IMAGE=debian:bookworm-slim ARG BASE_IMAGE=debian:bookworm-slim
FROM ${BASE_IMAGE} AS build-scripts FROM ${BASE_IMAGE} AS build-scripts
@ -32,7 +32,7 @@ FROM base AS sasl
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git
ARG SASL_XOAUTH2_GIT_REF=release-0.26 ARG SASL_XOAUTH2_GIT_REF=release-0.25
# --mount=type=cache,target=/var/cache/apk,sharing=locked,id=var-cache-apk-$TARGETPLATFORM \ # --mount=type=cache,target=/var/cache/apk,sharing=locked,id=var-cache-apk-$TARGETPLATFORM \
# --mount=type=cache,target=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \ # --mount=type=cache,target=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \

View file

@ -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)**. - **[`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 `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. 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 third-party project. Checkout is from master branch, based
on specific SHA commit id. The same hash is used for master and tags. 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: - **Architecture galore!** With the addition of debian images, we now support support more architectures than ever. The list includes:

View file

@ -1,34 +1,25 @@
diff --git a/Dockerfile b/Dockerfile diff --git a/Dockerfile b/Dockerfile
index 75a22d8..81145c9 100644 index a3327d8..1cdfa84 100644
--- a/Dockerfile --- a/Dockerfile
+++ b/Dockerfile +++ b/Dockerfile
@@ -1,8 +1,41 @@ @@ -1,4 +1,10 @@
-FROM scratch -FROM golang:1.16 AS builder
+# syntax=docker/dockerfile:1.2 +# syntax=docker/dockerfile:1.2
+FROM golang:1.23 AS builder +FROM golang:1.21.3-bookworm AS builder
LABEL org.opencontainers.image.source="https://github.com/hsn723/postfix_exporter" \
org.opencontainers.image.authors="Hsn723" \
org.opencontainers.image.title="postfix_exporter"
+ARG TARGETPLATFORM +ARG TARGETPLATFORM
+ARG TARGETOS +ARG TARGETOS
+ARG TARGETARCH +ARG TARGETARCH
+ARG TARGETVARIANT +ARG TARGETVARIANT
+ +
+WORKDIR /src WORKDIR /src
+
+# avoid downloading the dependencies on successive builds # avoid downloading the dependencies on succesive builds
+RUN apt-get update -qq && apt-get install -qqy \ @@ -14,10 +20,18 @@ COPY . .
+ build-essential \
+ libsystemd-dev # Force the go compiler to use modules
+ ENV GO111MODULE=on
+COPY go.mod go.sum ./ -RUN go test
+RUN go mod download -RUN go build -o /bin/postfix_exporter
+RUN go mod verify
+
+COPY . .
+
+# Force the go compiler to use modules
+ENV GO111MODULE=on
+# go test fails (sometimes) because it relies on an external dependency: +# go test fails (sometimes) because it relies on an external dependency:
+# +#
+# warning: SASL authentication failure: cannot connect to saslauthd server: Permission denied +# warning: SASL authentication failure: cannot connect to saslauthd server: Permission denied
@ -39,12 +30,10 @@ index 75a22d8..81145c9 100644
+# Hence disabling the test here. +# Hence disabling the test here.
+# RUN go test +# 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 +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 +FROM scratch
EXPOSE 9154 EXPOSE 9154
-COPY postfix_exporter / WORKDIR /
-COPY LICENSE / COPY --from=builder /bin/postfix_exporter /bin/
-ENTRYPOINT ["/postfix_exporter"]
+WORKDIR /
+COPY --from=builder /bin/postfix_exporter /bin/
+ENTRYPOINT ["/bin/postfix_exporter"]