This commit is contained in:
Cabillot Julien 2018-03-19 16:42:28 +01:00
commit 86abf6b5e5
3 changed files with 47 additions and 0 deletions

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM "alpine:3.7"
LABEL maintainer="Cabillot Julien <dockerimages@cabillot.eu>"
COPY entrypoint.sh /entrypoint.sh
RUN apk add --no-cache offlineimap openssl && \
adduser -D offlineimap
COPY offlineimaprc /home/offlineimap/.offlineimaprc
# Add Tini
#ENV "TINI_VERSION" "v0.16.1"
#ADD "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" "/tini"
#RUN chmod +x "/tini"
#ENTRYPOINT ["/tini", "--"]
USER "offlineimap"
#ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/entrypoint.sh" ]

10
entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -o pipefail -o nounset -o errexit
# Récupère le certificat fourni par le serveur
IMAP_CERT="$(openssl s_client -connect "${IMAP_SRV}:993" </dev/null 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | openssl x509 -noout -fingerprint -sha1 -inform pem | cut -d'=' -f2 | sed 's/://g')"
sed -i'' "s/XXX_REPLACE_USER_XXX/${IMAP_USER}/g;s/XXX_REPLACE_PASS_XXX/${IMAP_PASS}/g;s/XXX_REPLACE_SRV_XXX/${IMAP_SRV}/g;s/XXX_REPLACE_FINGERPRINT_XXX/${IMAP_CERT}/g" "/home/offlineimap/.offlineimaprc"
exec offlineimap -c "/home/offlineimap/.offlineimaprc" 2>/dev/null

18
offlineimaprc Normal file
View File

@ -0,0 +1,18 @@
[general]
accounts = main
[Account main]
localrepository = main-local
remoterepository = main-remote
[Repository main-local]
type = Maildir
localfolders = /dump
[Repository main-remote]
type = IMAP
#sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteuser = XXX_REPLACE_USER_XXX
remotepass = XXX_REPLACE_PASS_XXX
remotehost = XXX_REPLACE_SRV_XXX
cert_fingerprint = XXX_REPLACE_FINGERPRINT_XXX