commit 86abf6b5e59aa9460bc48afe54b64b3ac426759b Author: Cabillot Julien Date: Mon Mar 19 16:42:28 2018 +0100 import diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb0da55 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM "alpine:3.7" +LABEL maintainer="Cabillot Julien " + +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" ] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..b726f36 --- /dev/null +++ b/entrypoint.sh @@ -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 | 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 diff --git a/offlineimaprc b/offlineimaprc new file mode 100644 index 0000000..ece681b --- /dev/null +++ b/offlineimaprc @@ -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