diff --git a/postfix/Dockerfile b/postfix/Dockerfile index 1116ee0..629f94a 100644 --- a/postfix/Dockerfile +++ b/postfix/Dockerfile @@ -1,13 +1,16 @@ FROM debian:bookworm-slim +COPY entrypoint.sh /entrypoint.sh + RUN apt-get update && \ apt-get -y upgrade && \ apt-get -y --purge autoremove && \ apt-get -y install postfix postfix-pgsql postgrey && \ - apt-get -y clean + apt-get -y clean && \ + chmod a+x /entrypoint.sh EXPOSE 25/tcp EXPOSE 465/tcp EXPOSE 587/tcp -CMD ["/usr/sbin/postfix", "start-fg"] \ No newline at end of file +CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/postfix/entrypoint.sh b/postfix/entrypoint.sh new file mode 100644 index 0000000..0d49323 --- /dev/null +++ b/postfix/entrypoint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +for cf in /etc/postfix/*.cf; do + sed -iE -e 's/%DB_PASSWORD%/${DB_PASSWORD}/g' \ + -e 's/%DB_HOST%/${DB_HOST}/g' \ + -e 's/%DB_USER%/${DB_USER}/g' \ + -e 's/%DB_DATABASE%/${DB_DATABASE}/g' ${cf}; +done + +/usr/sbin/postfix start-fg