mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-07 15:04:56 +08:00
Compare commits
4 commits
12708dc8c7
...
a99abca165
Author | SHA1 | Date | |
---|---|---|---|
|
a99abca165 | ||
|
6b6d67eeac | ||
|
3fc96164b2 | ||
|
b359a946bf |
4 changed files with 25 additions and 36 deletions
|
@ -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,8 +68,8 @@ runs:
|
|||
push: true
|
||||
tags: '${{ inputs.tags }}'
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: "linux/amd64,linux/arm/v6,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"
|
||||
#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
|
||||
|
||||
|
|
|
@ -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 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
|
||||
|
||||
FROM ${BASE_IMAGE} AS build-scripts
|
||||
|
@ -32,7 +32,7 @@ FROM base AS sasl
|
|||
|
||||
ARG TARGETPLATFORM
|
||||
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=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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/
|
||||
|
Loading…
Add table
Reference in a new issue