From 65f0bc11731280ba4db001a6d74b13df95a8e521 Mon Sep 17 00:00:00 2001 From: Frederick Ding Date: Thu, 30 Jul 2015 21:51:11 -0400 Subject: [PATCH] initial framework --- Dockerfile | 23 +++++++++++++++++++++++ docker-entrypoint.sh | 0 save-attachments.crontab | 2 ++ save-attachments.sh | 6 ++++++ 4 files changed, 31 insertions(+) create mode 100644 Dockerfile create mode 100755 docker-entrypoint.sh create mode 100644 save-attachments.crontab create mode 100755 save-attachments.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d9e564 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:latest + +MAINTAINER Ding Corporation + +# install packages +RUN apt-get update \ + && apt-get install -y fetchmail maildrop mpack \ + && apt-get clean && rm -fr /var/lib/apt/lists/* + +VOLUME /var/mail +VOLUME /config + +RUN maildirmake /var/mail/working \ + && echo "to /var/mail/working" > /root/.mailfilter +TOUCH /var/mail/save-attachments.log + +ADD save-attachments.crontab /etc/cron.d/save-attachments +ADD save-attachments.sh /opt/save-attachments.sh +RUN chmod 0644 /etc/cron.d/save-attachments + +ADD docker-entrypoint.sh /opt/docker-entrypoint.sh +ENTRYPOINT ["/opt/docker-entrypoint.sh"] +CMD cron && tail -f /var/mail/save-attachments.log diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..e69de29 diff --git a/save-attachments.crontab b/save-attachments.crontab new file mode 100644 index 0000000..983d13c --- /dev/null +++ b/save-attachments.crontab @@ -0,0 +1,2 @@ +*/5 * * * * mail /opt/save-attachments.sh >> /var/mail/save-attachments.log 2>&1 + diff --git a/save-attachments.sh b/save-attachments.sh new file mode 100755 index 0000000..d7e8880 --- /dev/null +++ b/save-attachments.sh @@ -0,0 +1,6 @@ +#!/bin/bash +LOG=/dev/stderr +echo "== $(date -Is) ==" >> $LOG + +fetchmail +