From 7cc8bbc55e518b5765000876430097ddd37129ef Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Wed, 10 Jun 2026 15:45:12 +0200 Subject: [PATCH 01/17] Add link to pipeline --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 45c8c79..046510b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,5 +1,7 @@ name: Docker +# Many ports copyied from https://docs.docker.com/build/ci/github-actions/manage-tags-labels/ + # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support From cbb6993247efb7dd0b6a140cf342b9bd38de8868 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 16:59:41 +0200 Subject: [PATCH 02/17] Add entrypoint with more logic --- Dockerfile | 3 +- entrypoint.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index ef737b5..7d8e736 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ EXPOSE 25 465 587 VOLUME [ "/var/spool/postfix" ] COPY VERSION / +COPY entrypoint.sh / -ENTRYPOINT ["/usr/sbin/postfix", "start-fg"] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..ad30480 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +logger () { + if [ ${ENTRYPOINT_DEBUG,,} == "true" ]; then + echo "$1" + else + if [ -n "$2" ]; then + echo "$2" + fi + fi +} + +postfix_copy_replace_env () { + # copy file and replace env vars (syntax: https://doc.dovecot.org/main/core/settings/syntax.html#environment-variables) + rm -f "$2" + LINENR=1 + while IFS= read -r line; do + MATCHES="$(echo "$line" | grep -oP '(=|\s)(%{ENV:\w+}|\$ENV:\w+)(\s|$)')" + if [[ "$?" -eq 0 ]]; then + while IFS= read -r MATCH; do + ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" + ENVVALUE="${!ENVNAME}" + FIRSTCHAR="$(echo "$MATCH" | cut -c1)" + LASTCHAR="$(echo "$MATCH" | rev | cut -c1)" + if [ ! "$LASTCHAR" == " " ]; then + LASTCHAR="" + fi + line="$(echo "$line" | sed "s#${MATCH}#${FIRSTCHAR}${ENVVALUE}${LASTCHAR}#")" + logger "Found $ENVNAME in ${1}:$LINENR and replced with \"$ENVVALUE\"" + done <<< "$MATCHES" + fi + echo "$line" >> "$2" + ((LINENR++)) + done < "$1" +} + +postfix_compile_maps () { + MAPS=$(grep -vP "^\s*#.*$" "$1" | grep -oP "lmdb:/\S+") + if [[ "$?" -eq 0 ]]; then + while IFS= read -r MAP; do + FILE="$(echo "$MAP" | rev | cut -d':' -f1 | rev)" + if [ -e "$FILE" ]; then + logger "Compile postfix-map $MAP" + postmap "$MAP" || logger "postmap for $MAP failed with exitcode $?" "postmap for $MAP failed" + else + logger "postmap $MAP, file not found!" + fi + done <<< "$MAPS" + fi +} + +if [ -d "/etc/postfix.template/" ]; then + echo "Copy config from /etc/postfix.template/ to /etc/postfix/" + cp -r "/etc/postfix.template/" "/etc/postfix/" + find "/etc/postfix.template/" -iname "*.cf" | while read -r sourcefile; do + targetfile=$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#') + if [ ! ${DISABLE_ENV_REPLACE,,} == true ]; then + postfix_copy_replace_env "$sourcefile" "$targetfile" + fi + if [ ! ${DISABLE_AUTO_COMPILE_MAPS,,} == true ]; then + postfix_compile_maps "$targetfile" + fi + done +fi + +if [ ! ${DISABLE_POSTCONF_OVERWRITE,,} == true ]; then + postconf -e maillog_file=/dev/stdout +fi + +if [ -d "/entrypoint.d/" ]; then + for script in /entrypoint.d/*.sh; do + if [ -x "$script" ]; then + echo "Run script $script" + "$script" + fi + done +fi + +exec /usr/sbin/postfix start-fg From e36fd1940a223169bec5aea7d11d1b58d57cedaa Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:06:54 +0200 Subject: [PATCH 03/17] Fix syntax error --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ad30480..87d4184 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,7 +17,7 @@ postfix_copy_replace_env () { while IFS= read -r line; do MATCHES="$(echo "$line" | grep -oP '(=|\s)(%{ENV:\w+}|\$ENV:\w+)(\s|$)')" if [[ "$?" -eq 0 ]]; then - while IFS= read -r MATCH; do + echo "$MATCHES" | while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" ENVVALUE="${!ENVNAME}" FIRSTCHAR="$(echo "$MATCH" | cut -c1)" @@ -27,7 +27,7 @@ postfix_copy_replace_env () { fi line="$(echo "$line" | sed "s#${MATCH}#${FIRSTCHAR}${ENVVALUE}${LASTCHAR}#")" logger "Found $ENVNAME in ${1}:$LINENR and replced with \"$ENVVALUE\"" - done <<< "$MATCHES" + done fi echo "$line" >> "$2" ((LINENR++)) From 7a180be7d89c98020061257527dfa61287a81ef3 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:14:54 +0200 Subject: [PATCH 04/17] Fix syntax --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 87d4184..1081468 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,7 +37,7 @@ postfix_copy_replace_env () { postfix_compile_maps () { MAPS=$(grep -vP "^\s*#.*$" "$1" | grep -oP "lmdb:/\S+") if [[ "$?" -eq 0 ]]; then - while IFS= read -r MAP; do + echo "$MAPS" | while IFS= read -r MAP; do FILE="$(echo "$MAP" | rev | cut -d':' -f1 | rev)" if [ -e "$FILE" ]; then logger "Compile postfix-map $MAP" @@ -45,7 +45,7 @@ postfix_compile_maps () { else logger "postmap $MAP, file not found!" fi - done <<< "$MAPS" + done fi } From 150ddec9c1d16afbdcbcd0ab5c41cd5ea23580ca Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 18:15:17 +0200 Subject: [PATCH 05/17] make entrypoint posix compliant --- entrypoint.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1081468..f63955e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh logger () { - if [ ${ENTRYPOINT_DEBUG,,} == "true" ]; then + if [ "$(echo "$ENTRYPOINT_DEBUG" | tr '[:upper:]' '[:lower:]')" = "true" ]; then echo "$1" else if [ -n "$2" ]; then @@ -15,28 +15,29 @@ postfix_copy_replace_env () { rm -f "$2" LINENR=1 while IFS= read -r line; do - MATCHES="$(echo "$line" | grep -oP '(=|\s)(%{ENV:\w+}|\$ENV:\w+)(\s|$)')" - if [[ "$?" -eq 0 ]]; then + # shellcheck disable=SC2016 + if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%{ENV:\w+}|\$ENV:\w+)(\s|$)')"; then echo "$MATCHES" | while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" - ENVVALUE="${!ENVNAME}" + ENVVALUE="$(eval echo \"\$$ENVNAME\")" FIRSTCHAR="$(echo "$MATCH" | cut -c1)" LASTCHAR="$(echo "$MATCH" | rev | cut -c1)" - if [ ! "$LASTCHAR" == " " ]; then + if [ ! "$LASTCHAR" = " " ]; then LASTCHAR="" fi + # shellcheck disable=SC2030 line="$(echo "$line" | sed "s#${MATCH}#${FIRSTCHAR}${ENVVALUE}${LASTCHAR}#")" logger "Found $ENVNAME in ${1}:$LINENR and replced with \"$ENVVALUE\"" done fi + # shellcheck disable=SC2031 echo "$line" >> "$2" - ((LINENR++)) + LINENR=$((LINENR+1)) done < "$1" } postfix_compile_maps () { - MAPS=$(grep -vP "^\s*#.*$" "$1" | grep -oP "lmdb:/\S+") - if [[ "$?" -eq 0 ]]; then + if MAPS=$(grep -vE "^\s*#.*$" "$1" | grep -oE "lmdb:/\S+"); then echo "$MAPS" | while IFS= read -r MAP; do FILE="$(echo "$MAP" | rev | cut -d':' -f1 | rev)" if [ -e "$FILE" ]; then @@ -54,16 +55,16 @@ if [ -d "/etc/postfix.template/" ]; then cp -r "/etc/postfix.template/" "/etc/postfix/" find "/etc/postfix.template/" -iname "*.cf" | while read -r sourcefile; do targetfile=$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#') - if [ ! ${DISABLE_ENV_REPLACE,,} == true ]; then + if [ ! "$(echo "$DISABLE_ENV_REPLACE" | tr '[:upper:]' '[:lower:]')" = true ]; then postfix_copy_replace_env "$sourcefile" "$targetfile" fi - if [ ! ${DISABLE_AUTO_COMPILE_MAPS,,} == true ]; then + if [ ! "$(echo "$DISABLE_AUTO_COMPILE_MAPS" | tr '[:upper:]' '[:lower:]')" = true ]; then postfix_compile_maps "$targetfile" fi done fi -if [ ! ${DISABLE_POSTCONF_OVERWRITE,,} == true ]; then +if [ ! "$(echo "$DISABLE_POSTCONF_OVERWRITE" | tr '[:upper:]' '[:lower:]')" = true ]; then postconf -e maillog_file=/dev/stdout fi From 7b801a16e13cda9afbee942a8d73c1fac11c67ee Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 18:28:43 +0200 Subject: [PATCH 06/17] Fix some syntax errors --- entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f63955e..4548acc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,9 +16,10 @@ postfix_copy_replace_env () { LINENR=1 while IFS= read -r line; do # shellcheck disable=SC2016 - if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%{ENV:\w+}|\$ENV:\w+)(\s|$)')"; then + if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{ENV:\w+\}|\$ENV:\w+)(\s|$)')"; then echo "$MATCHES" | while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" + # shellcheck disable=SC2086 ENVVALUE="$(eval echo \"\$$ENVNAME\")" FIRSTCHAR="$(echo "$MATCH" | cut -c1)" LASTCHAR="$(echo "$MATCH" | rev | cut -c1)" @@ -52,7 +53,7 @@ postfix_compile_maps () { if [ -d "/etc/postfix.template/" ]; then echo "Copy config from /etc/postfix.template/ to /etc/postfix/" - cp -r "/etc/postfix.template/" "/etc/postfix/" + cp -r /etc/postfix.template/* "/etc/postfix/" find "/etc/postfix.template/" -iname "*.cf" | while read -r sourcefile; do targetfile=$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#') if [ ! "$(echo "$DISABLE_ENV_REPLACE" | tr '[:upper:]' '[:lower:]')" = true ]; then From 8c207a6866397f187047a46837f9f9b9f8ddd88c Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 18:39:07 +0200 Subject: [PATCH 07/17] Improve copy --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4548acc..9107d50 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,7 +53,11 @@ postfix_compile_maps () { if [ -d "/etc/postfix.template/" ]; then echo "Copy config from /etc/postfix.template/ to /etc/postfix/" - cp -r /etc/postfix.template/* "/etc/postfix/" + find "/etc/postfix.template/" -not -type d | while read -r file; do + mkdir -p "$(dirname $file)" + cp --remove-destination "$(readlink $file)" "$file" + chmod 640 "$file" + done find "/etc/postfix.template/" -iname "*.cf" | while read -r sourcefile; do targetfile=$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#') if [ ! "$(echo "$DISABLE_ENV_REPLACE" | tr '[:upper:]' '[:lower:]')" = true ]; then From 59be439547fd3efca5e9e7e6a2d064a4dc62975c Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 19:56:29 +0200 Subject: [PATCH 08/17] Some more fixes --- entrypoint.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9107d50..28f2647 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,13 +53,13 @@ postfix_compile_maps () { if [ -d "/etc/postfix.template/" ]; then echo "Copy config from /etc/postfix.template/ to /etc/postfix/" - find "/etc/postfix.template/" -not -type d | while read -r file; do - mkdir -p "$(dirname $file)" - cp --remove-destination "$(readlink $file)" "$file" - chmod 640 "$file" + find "/etc/postfix.template/" ! -path "*/..*" ! -type d | while read -r file; do + targetfile="$(echo "$file" | sed 's#^/etc/postfix.template/#/etc/postfix/#')" + rm -f "$targetfile" + install -D -m 0640 "$file" "$targetfile" done - find "/etc/postfix.template/" -iname "*.cf" | while read -r sourcefile; do - targetfile=$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#') + find "/etc/postfix.template/" ! -path "*/..*" -iname "*.cf" ! -type d | while read -r sourcefile; do + targetfile="$(echo "$sourcefile" | sed 's#^/etc/postfix.template/#/etc/postfix/#')" if [ ! "$(echo "$DISABLE_ENV_REPLACE" | tr '[:upper:]' '[:lower:]')" = true ]; then postfix_copy_replace_env "$sourcefile" "$targetfile" fi From 1208612505ac11bd27fddb10bd041438c62a434e Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 20:11:15 +0200 Subject: [PATCH 09/17] make env case insensitive --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 28f2647..e15f07a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,7 +16,7 @@ postfix_copy_replace_env () { LINENR=1 while IFS= read -r line; do # shellcheck disable=SC2016 - if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{ENV:\w+\}|\$ENV:\w+)(\s|$)')"; then + if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{[Ee][Nn][Vv]:\w+\}|\$[Ee][Nn][Vv]:\w+)(\s|$)')"; then echo "$MATCHES" | while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" # shellcheck disable=SC2086 From 98f01cdf8ffeea88538bd4fc695c2cfa53bb6e61 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 20:37:47 +0200 Subject: [PATCH 10/17] Fix postfix_copy_replace_env --- entrypoint.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e15f07a..7a464bd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,8 +16,9 @@ postfix_copy_replace_env () { LINENR=1 while IFS= read -r line; do # shellcheck disable=SC2016 - if MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{[Ee][Nn][Vv]:\w+\}|\$[Ee][Nn][Vv]:\w+)(\s|$)')"; then - echo "$MATCHES" | while IFS= read -r MATCH; do + MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{[Ee][Nn][Vv]:\w+\}|\$[Ee][Nn][Vv]:\w+)(\s|$)')" + if [ -n "$MATCHES" ]; then + while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" # shellcheck disable=SC2086 ENVVALUE="$(eval echo \"\$$ENVNAME\")" @@ -26,19 +27,20 @@ postfix_copy_replace_env () { if [ ! "$LASTCHAR" = " " ]; then LASTCHAR="" fi - # shellcheck disable=SC2030 line="$(echo "$line" | sed "s#${MATCH}#${FIRSTCHAR}${ENVVALUE}${LASTCHAR}#")" - logger "Found $ENVNAME in ${1}:$LINENR and replced with \"$ENVVALUE\"" - done + logger "Found $ENVNAME in ${1}:$LINENR and replaced with \"$ENVVALUE\"" + done <> "$2" LINENR=$((LINENR+1)) done < "$1" } postfix_compile_maps () { - if MAPS=$(grep -vE "^\s*#.*$" "$1" | grep -oE "lmdb:/\S+"); then + MAPS=$(grep -vE "^\s*#.*$" "$1" | grep -oE "lmdb:/\S+") + if [ -n "$MAPS" ]; then echo "$MAPS" | while IFS= read -r MAP; do FILE="$(echo "$MAP" | rev | cut -d':' -f1 | rev)" if [ -e "$FILE" ]; then From 7f26fe8e3e25642edfd61353853325713797fbe5 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 20:46:58 +0200 Subject: [PATCH 11/17] Fix ENV Syntax to match dovecot --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7a464bd..3cd23c8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,7 +16,7 @@ postfix_copy_replace_env () { LINENR=1 while IFS= read -r line; do # shellcheck disable=SC2016 - MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{[Ee][Nn][Vv]:\w+\}|\$[Ee][Nn][Vv]:\w+)(\s|$)')" + MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{ENV:\w+\}|\$ENV:\w+)(\s|$)')" if [ -n "$MATCHES" ]; then while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" From 6b9ee8dcd6d636b9ef04c13ac99691867268f841 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 21:16:32 +0200 Subject: [PATCH 12/17] Last Fix --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3cd23c8..9fe9553 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,7 +16,7 @@ postfix_copy_replace_env () { LINENR=1 while IFS= read -r line; do # shellcheck disable=SC2016 - MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{ENV:\w+\}|\$ENV:\w+)(\s|$)')" + MATCHES="$(echo "$line" | grep -oE '(=|\s)(%\{env:\w+\}|\$ENV:\w+)(\s|$)')" if [ -n "$MATCHES" ]; then while IFS= read -r MATCH; do ENVNAME="$(echo "$MATCH" | cut -d':' -f2 | cut -d'}' -f1)" From edf2f39c076dbd40524c70a7969749cb50783e04 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 22:18:37 +0200 Subject: [PATCH 13/17] Add lightwight build --- .github/workflows/docker.yml | 34 +++++++++++++++++++++------------- Dockerfile | 7 ++++++- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 046510b..eaf8a8a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,18 +25,26 @@ env: jobs: build: - runs-on: ubuntu-latest permissions: contents: read packages: write + strategy: + matrix: + include: + - variant: latest + build_arg: "INCLUDE_DEV_TOOLS=false" + tag_suffix: "latest" + + - variant: latest-dev + build_arg: "INCLUDE_DEV_TOOLS=true" + tag_suffix: "latest-dev" + steps: - name: Checkout repository uses: actions/checkout@v3 - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' uses: docker/login-action@v4 @@ -45,19 +53,9 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v6 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Setup Docker buildx uses: docker/setup-buildx-action@v4 - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push uses: docker/build-push-action@v7 @@ -67,3 +65,13 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + - name: Build and push Docker image - ${{ matrix.variant }} + id: build-and-push + uses: docker/build-push-action@v7 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: ${{ matrix.build_arg }} + tags: | + ${{ github.ref == 'refs/heads/master' && format('{0}/${1}:{2}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix) || format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) }} + ${{ github.ref == 'refs/heads/master' && format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix, github.sha) || format('{0}/${1}:{2}-{3}-{4}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix, github.sha) }} diff --git a/Dockerfile b/Dockerfile index 7d8e736..9302af5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,18 @@ +ARG INCLUDE_DEV_TOOLS=false + FROM alpine:3.22 RUN apk add --no-cache --update \ - bash \ ca-certificates \ postfix \ postfix-doc \ postfix-ldap \ tzdata +RUN if [ "$INCLUDE_DEV_TOOLS" = "true" ]; then \ + apk add --no-cache bash bash-doc; \ + fi + EXPOSE 25 465 587 VOLUME [ "/var/spool/postfix" ] From b151d33484f7bec844cf735faabed771ffdf7fb8 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:53:07 +0200 Subject: [PATCH 14/17] Fix docker build Removed redundant Docker image build step for pull requests. --- .github/workflows/docker.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index eaf8a8a..ed1d623 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -56,15 +56,6 @@ jobs: - name: Setup Docker buildx uses: docker/setup-buildx-action@v4 - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v7 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Build and push Docker image - ${{ matrix.variant }} id: build-and-push uses: docker/build-push-action@v7 From 31a066b00a2c7a1fb87e615836cb818bd2d1091c Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:54:47 +0200 Subject: [PATCH 15/17] Fix Docker tags formatting in workflow --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ed1d623..d23d703 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -64,5 +64,5 @@ jobs: push: ${{ github.event_name != 'pull_request' }} build-args: ${{ matrix.build_arg }} tags: | - ${{ github.ref == 'refs/heads/master' && format('{0}/${1}:{2}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix) || format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) }} - ${{ github.ref == 'refs/heads/master' && format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix, github.sha) || format('{0}/${1}:{2}-{3}-{4}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix, github.sha) }} + ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix) || format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) }} + ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix, github.sha) || format('{0}/${1}:{2}-{3}-{4}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix, github.sha) }} From 513264edcfb9387d308db22bd4842de05c893551 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:56:11 +0200 Subject: [PATCH 16/17] Refactor Docker tags formatting in workflow --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d23d703..b273594 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -64,5 +64,5 @@ jobs: push: ${{ github.event_name != 'pull_request' }} build-args: ${{ matrix.build_arg }} tags: | - ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix) || format('{0}/${1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) }} - ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix, github.sha) || format('{0}/${1}:{2}-{3}-{4}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix, github.sha) }} + ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix) || format('{0}/{1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) }} + ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:{2}-{3}', env.REGISTRY, env.IMAGE_NAME, matrix.tag_suffix, github.sha) || format('{0}/{1}:{2}-{3}-{4}', env.REGISTRY, env.IMAGE_NAME, github.ref_name, matrix.tag_suffix, github.sha) }} From 673c3e1239fbb025ac11632f142bc630b2d461f6 Mon Sep 17 00:00:00 2001 From: Pflum <59760697+Pflum@users.noreply.github.com> Date: Mon, 15 Jun 2026 00:01:36 +0200 Subject: [PATCH 17/17] Change IMAGE_NAME to pflum/docker-postfix --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b273594..9c55a02 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,7 +20,7 @@ env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io # github.repository as / - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: pflum/docker-postfix jobs: