6 Commits

Author SHA1 Message Date
724e94afb6 reduce debug output
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-10 16:46:07 +01:00
fd5d006c33 documentation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-12-10 16:43:49 +01:00
e8f66cd354 documentation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-12-10 16:42:35 +01:00
93801d7577 documentation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-12-10 16:40:17 +01:00
62a301cc58 two destinations
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-10 14:32:50 +01:00
ae2a789c3c quay fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-10 14:30:58 +01:00
4 changed files with 98 additions and 16 deletions

View File

@ -1,22 +1,22 @@
steps:
# build:
# image: plugins/kaniko
# settings:
# repo: ${FORGE_NAME}/${CI_REPO}
# registry:
# from_secret: container_registry
# tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
# username:
# from_secret: container_registry_username
# password:
# from_secret: container_registry_password
# dockerfile: Dockerfile
# when:
# - event: [push, tag]
build:
image: plugins/kaniko
settings:
repo: wollud1969/exim-docker
repo: ${FORGE_NAME}/${CI_REPO}
registry:
from_secret: container_registry
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
username:
from_secret: container_registry_username
password:
from_secret: container_registry_password
dockerfile: Dockerfile
when:
- event: [push, tag]
build:
image: plugins/kaniko
settings:
repo: quay.io/wollud1969/exim-docker
registry: quay.io
tags:
- latest

26
examples/start-mailer.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
IMAGE=quay.io/wollud1969/exim-docker:0.0.9
MAILER_NETWORK=mailer-network
docker network inspect $MAILER_NETWORK > /dev/null || docker network create $MAILER_NETWORK
if [ "$RELAYNETS" = "" ]; then
RELAYNETS=`docker network inspect $MAILER_NETWORK --format '{{ (index .IPAM.Config 0).Subnet }}'`
fi
docker run \
-d \
-e SMARTHOST=smarthost.example.com \
-e LOCALMAILNAME=example.com \
-e RELAYNETS=$RELAYNETS \
-e ROOT=root@example.com \
--network $MAILER_NETWORK \
--name mailer \
--restart always \
$IMAGE

56
readme.md Normal file
View File

@ -0,0 +1,56 @@
# EXIM4 from Debian in a container
This image can be used to deploy an MTA in a container and connect it to a smarthost to provide the
option to send mail from other containers without the need to configure the smarthost in each of them.
## Configuration
Four environment variables are used to configure the container:
* `SMARTHOST`: The is the name of the smarthost. exim within this container will send all mail to this smarthost for further delivery. Make sure the smarthost accepts mail from this container without authentication.
* `LOCALMAILNAME`: The domain name which shall be used as the domain part of the sender address in every outgoing mail.
* `RELAYNETS`: Networks exim in this container accepts for relaying. Separate multiple networks by semicolon.
* `ROOT`: Addresses to forward root mail to. Separate multiple addresses by space.
## Deployment
Typically, don't expose the smtp port of this container to the default network of your Docker installation, otherwise it conflicts with a local MTA on the machine and it would be visible outside of the machine. Create a dedicated docker network, use that one as the default network for this container and connect other containers to that network. Afterwards, you can use the name of this container as smarthost address in the other containers.
## Example start script
```
#!/bin/bash
IMAGE=quay.io/wollud1969/exim-docker:0.0.9
MAILER_NETWORK=mailer-network
docker network create $MAILER_NETWORK || echo "mailer-network already exists"
if [ "$RELAYNETS" = "" ]; then
RELAYNETS=`docker network inspect $MAILER_NETWORK --format '{{ (index .IPAM.Config 0).Subnet }}'`
fi
docker run \
-d \
-e SMARTHOST=smarthost.example.com \
-e LOCALMAILNAME=krohne.com \
-e RELAYNETS=$RELAYNETS \
-e ROOT=root@example.com \
--network $MAILER_NETWORK \
--name mailer \
--restart always \
$IMAGE
```
## Usage in other containers
Connect other containers to the mailer network:
```
docker network connect mailer-network name_of_other_container
```
Now you can use the name of the mailer container, here `mailer` as smarthost name in that other container.

View File

@ -1,5 +1,5 @@
#!/bin/bash
./adjust-config.sh
exim -bd -q15m -v
exim -bd -q15m