Skip to content

Commit

Permalink
Support MySQL, PosgreSQL and SQLite via OpenDBX (#9, #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Jul 14, 2023
1 parent 74faee0 commit d534901
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ All user visible changes to this project will be documented in this file. This p



## [2.11.0-Beta2-r4] · 2023-06-??
## [2.11.0-Beta2-r4] · 2023-07-14
[2.11.0-Beta2-r4]: /../../tree/2.11.0-Beta2-r4

[Diff](/../../compare/2.11.0-Beta2-r3...2.11.0-Beta2-r4)

### Added

- Support of [MySQL], [PostgreSQL] and [SQLite] via [OpenDBX]. ([#9], [#8])

### Upgraded

- [Debian Linux] "bookworm": <https://www.debian.org/releases/bookworm>
Expand All @@ -19,6 +23,9 @@ All user visible changes to this project will be documented in this file. This p

- [Alpine Linux] 3.18.2: <https://github.com/docker-library/official-images/commit/b187a3b64f4b23f4de4aef23b98cef0a128aa8f1>

[#8]: /../../issues/8
[#9]: /../../pull/9




Expand Down Expand Up @@ -447,6 +454,10 @@ All user visible changes to this project will be documented in this file. This p

[Alpine Linux]: https://www.alpinelinux.org
[Debian Linux]: https://www.debian.org
[MySQL]: https://www.mysql.com
[OpenDBX]: https://www.linuxnetworks.de/doc/index.php/OpenDBX
[OpenDKIM]: http://www.opendkim.org
[PostgreSQL]: https://www.postgresql.org
[s6-overlay]: https://github.com/just-containers/s6-overlay
[Semantic Versioning 2.0.0]: https://semver.org
[SQLite]: https://www.sqlite.org
16 changes: 14 additions & 2 deletions Dockerfile.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<? if ($isAlpineImage) { ?>
# https://hub.docker.com/_/alpine
FROM alpine:3.18.2
FROM alpine:3.18
<? } else { ?>
# https://hub.docker.com/_/debian
FROM debian:bookworm-slim
Expand All @@ -21,7 +21,10 @@
# Build and install OpenDKIM
<? if ($isAlpineImage) { ?>
# https://git.alpinelinux.org/cgit/aports/tree/community/opendkim/APKBUILD?h=<?= $AlpineRepoCommit."\n"; ?>
RUN apk update \
# TODO: Remove once `opendbx` Alpine package hits stable.
RUN echo "@edge-community https://dl-cdn.alpinelinux.org/alpine/edge/community" \
>> /etc/apk/repositories \
&& apk update \
&& apk upgrade \
&& apk add --no-cache \
ca-certificates \
Expand All @@ -39,12 +42,16 @@
&& apk add --no-cache --force \
libcrypto3 libssl3 \
libmilter \
opendbx \
opendbx-backend-mysql opendbx-backend-postgres opendbx-backend-sqlite \
# Perl and OpenSSL required for opendkim-* utilities
openssl perl \
<? } else { ?>
&& apt-get install -y --no-install-recommends --no-install-suggests \
libssl3 \
libmilter1.0.1 \
libopendbx1 \
libopendbx1-mysql libopendbx1-pgsql libopendbx1-sqlite3 \
libbsd0 \
<? } ?>
\
Expand All @@ -65,10 +72,12 @@
&& apk add --no-cache --virtual .build-deps \
openssl-dev \
libmilter-dev \
opendbx-dev \
<? } else { ?>
&& buildDeps=" \
libssl-dev \
libmilter-dev \
libopendbx1-dev \
libbsd-dev \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
Expand All @@ -86,6 +95,9 @@
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
13 changes: 11 additions & 2 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.tmpl.php

# https://hub.docker.com/_/alpine
FROM alpine:3.18.2
FROM alpine:3.18

ARG opendkim_ver=2.11.0-Beta2
ARG s6_overlay_ver=3.1.5.0


# Build and install OpenDKIM
# https://git.alpinelinux.org/cgit/aports/tree/community/opendkim/APKBUILD?h=4322107ba395a710a041ee479c5805c97169a36b
RUN apk update \
# TODO: Remove once `opendbx` Alpine package hits stable.
RUN echo "@edge-community https://dl-cdn.alpinelinux.org/alpine/edge/community" \
>> /etc/apk/repositories \
&& apk update \
&& apk upgrade \
&& apk add --no-cache \
ca-certificates \
Expand All @@ -20,6 +23,8 @@ RUN apk update \
&& apk add --no-cache --force \
libcrypto3 libssl3 \
libmilter \
opendbx \
opendbx-backend-mysql opendbx-backend-postgres opendbx-backend-sqlite \
# Perl and OpenSSL required for opendkim-* utilities
openssl perl \
\
Expand All @@ -31,6 +36,7 @@ RUN apk update \
&& apk add --no-cache --virtual .build-deps \
openssl-dev \
libmilter-dev \
opendbx-dev \
\
# Download and prepare OpenDKIM sources
&& curl -fL -o /tmp/opendkim.tar.gz \
Expand All @@ -43,6 +49,9 @@ RUN apk update \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
6 changes: 6 additions & 0 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
libssl3 \
libmilter1.0.1 \
libopendbx1 \
libopendbx1-mysql libopendbx1-pgsql libopendbx1-sqlite3 \
libbsd0 \
\
# Install tools for building
Expand All @@ -33,6 +35,7 @@ RUN apt-get update \
&& buildDeps=" \
libssl-dev \
libmilter-dev \
libopendbx1-dev \
libbsd-dev \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
Expand All @@ -49,6 +52,9 @@ RUN apt-get update \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
7 changes: 7 additions & 0 deletions tests/main.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
[ "$actual" == "$expected" ]
}

@test "opendkim: opendbx supported" {
run docker run --rm --pull never --entrypoint sh $IMAGE -c \
'opendkim -V | grep -F USE_ODBX'
[ "$status" -eq 0 ]
}


@test "opendkim-genkey: runs ok" {
run docker run --rm --pull never --entrypoint sh $IMAGE -c \
'opendkim-genkey && [ -f default.private ] && [ -f default.txt ]'
Expand Down

0 comments on commit d534901

Please sign in to comment.