summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.dockerignore1
-rw-r--r--Dockerfile26
-rw-r--r--content/etc/davmail/davmail.properties.template138
-rw-r--r--content/etc/profile.d/java.sh1
-rwxr-xr-xcontent/opt/davmail/entrypoint.sh21
5 files changed, 187 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..6b8710a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+.git
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ce55fe4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,26 @@
+FROM jeanblanchard/java:8
+MAINTAINER James Z.M. Gao <gaozm55@gmail.com>
+
+# Download
+ADD http://downloads.sourceforge.net/project/davmail/davmail/4.7.2/davmail-linux-x86_64-4.7.2-2427.tgz /opt/
+COPY content /
+
+# untar file, add a non-root system user
+# note we specify a id so as to *try* to avoid collisions on the host
+RUN apk --update upgrade && \
+ cd /opt && \
+ tar -xzv -f davmail-linux-x86_64-4.7.2-2427.tgz && \
+ mv /opt/davmail-*/* /opt/davmail/ && \
+ rm -rf /var/cache/apk/* /tmp/* /opt/davmail-* && \
+ adduser -S -u 500 -h /var/lib/davmail davmail && \
+ chmod 0644 /etc/davmail/*
+
+USER davmail
+
+EXPOSE 1080
+EXPOSE 1143
+EXPOSE 1389
+EXPOSE 1110
+EXPOSE 1025
+WORKDIR /opt/davmail
+ENTRYPOINT ["/opt/davmail/entrypoint.sh"]
diff --git a/content/etc/davmail/davmail.properties.template b/content/etc/davmail/davmail.properties.template
new file mode 100644
index 0000000..03e9818
--- /dev/null
+++ b/content/etc/davmail/davmail.properties.template
@@ -0,0 +1,138 @@
+# DavMail settings, see http://davmail.sourceforge.net/ for documentation
+
+#############################################################
+# Basic settings
+
+# Server or workstation mode
+davmail.server=true
+# connection mode auto, EWS or WebDav
+davmail.enableEws=auto
+# base Exchange OWA or EWS url
+davmail.url=${DAVMAIL_URL}
+
+# Listener ports
+davmail.caldavPort=1080
+davmail.imapPort=1143
+davmail.ldapPort=1389
+davmail.popPort=1110
+davmail.smtpPort=1025
+
+#############################################################
+# Network settings
+
+# Network proxy settings
+davmail.enableProxy=false
+davmail.useSystemProxies=false
+davmail.proxyHost=
+davmail.proxyPort=
+davmail.proxyUser=
+davmail.proxyPassword=
+
+# proxy exclude list
+davmail.noProxyFor=
+
+# allow remote connection to DavMail
+davmail.allowRemote=true
+# bind server sockets to a specific address
+davmail.bindAddress=
+# client connections SO timeout in seconds
+davmail.clientSoTimeout=
+
+# DavMail listeners SSL configuration
+davmail.ssl.keystoreType=
+davmail.ssl.keystoreFile=
+davmail.ssl.keystorePass=
+davmail.ssl.keyPass=
+
+# Accept specified certificate even if invalid according to trust store
+davmail.server.certificate.hash=${DAVMAIL_SERVER_CERTIFICATE_HASH}
+
+# disable SSL for specified listeners
+davmail.ssl.nosecurecaldav=false
+davmail.ssl.nosecureimap=false
+davmail.ssl.nosecureldap=false
+davmail.ssl.nosecurepop=false
+davmail.ssl.nosecuresmtp=false
+
+# disable update check
+davmail.disableUpdateCheck=true
+
+# Send keepalive character during large folder and messages download
+davmail.enableKeepalive=false
+# Message count limit on folder retrieval
+davmail.folderSizeLimit=0
+# Default windows domain for NTLM and basic authentication
+davmail.defaultDomain=${DAVMAIL_NTLM_DOMAIN}
+
+#############################################################
+# Caldav settings
+
+# override default alarm sound
+davmail.caldavAlarmSound=
+# retrieve calendar events not older than 90 days
+davmail.caldavPastDelay=90
+# WebDav only: force event update to trigger ActiveSync clients update
+davmail.forceActiveSyncUpdate=false
+
+#############################################################
+# IMAP settings
+
+# Delete messages immediately on IMAP STORE \Deleted flag
+davmail.imapAutoExpunge=true
+# Enable IDLE support, set polling delay in minutes
+davmail.imapIdleDelay=
+
+#############################################################
+# POP settings
+
+# Delete messages on server after 40 days
+davmail.keepDelay=40
+# Delete messages in server sent folder after 90 days
+davmail.sentKeepDelay=90
+# Mark retrieved messages read on server
+davmail.popMarkReadOnRetr=false
+
+#############################################################
+# SMTP settings
+
+# let Exchange save a copy of sent messages in Sent folder
+davmail.smtpSaveInSent=true
+
+#############################################################
+# Loggings settings
+
+# log file path, leave empty for default path
+#davmail.logFilePath=/var/log/davmail.log
+davmail.logFilePath=/dev/null
+# maximum log file size, use Log4J syntax, set to 0 to use an external rotation mechanism, e.g. logrotate
+#davmail.logFileSize=1MB
+davmail.logFileSize=0
+# log levels
+log4j.logger.davmail=WARN, default.out
+log4j.logger.httpclient.wire=WARN, default.out
+log4j.logger.org.apache.commons.httpclient=WARN, default.out
+log4j.rootLogger=WARN, default.out
+log4j.appender.default.out=org.apache.log4j.ConsoleAppender
+log4j.appender.default.out.threshold=INFO
+log4j.appender.default.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.default.out.layout.ConversionPattern=%-5p %c: %m%n
+
+#############################################################
+# Workstation only settings
+
+# smartcard access settings
+davmail.ssl.pkcs11Config=
+davmail.ssl.pkcs11Library=
+
+# SSL settings for mutual authentication
+davmail.ssl.clientKeystoreType=
+davmail.ssl.clientKeystoreFile=
+davmail.ssl.clientKeystorePass=
+
+# disable all balloon notifications
+davmail.disableGuiNotifications=false
+# disable startup balloon notifications
+davmail.showStartupBanner=true
+
+# enable transparent client Kerberos authentication
+davmail.enableKerberos=false
diff --git a/content/etc/profile.d/java.sh b/content/etc/profile.d/java.sh
new file mode 100644
index 0000000..a6aff28
--- /dev/null
+++ b/content/etc/profile.d/java.sh
@@ -0,0 +1 @@
+which java &>/dev/null || PATH="$PATH":"$JAVA_HOME"/bin
diff --git a/content/opt/davmail/entrypoint.sh b/content/opt/davmail/entrypoint.sh
new file mode 100755
index 0000000..7b3b518
--- /dev/null
+++ b/content/opt/davmail/entrypoint.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -el
+
+[ -z "$*" ] || exec "$@"
+
+CONFIG=${1:-/etc/davmail/davmail.properties}
+if [ -n "$DAVMAIL_CONFIG_URL" ]; then
+ CONFIG=$HOME/davmail.properties
+ wget -qO $CONFIG "$DAVMAIL_CONFIG_URL"
+elif [ -n "$DAVMAIL_URL" ]; then
+ CONFIG=$HOME/davmail.properties
+ while read line; do
+ eval echo "$line"
+ done < /etc/davmail/davmail.properties.template > $CONFIG
+fi
+
+if [ -r "$CONFIG" ]; then
+ exec /opt/davmail/davmail.sh "$CONFIG"
+else
+ echo "ERROR: can't read [$CONFIG]!"
+ return 1
+fi