jamesridgway / attachment-downloader

Simple tool for downloading email attachments for all emails in a given folder using an IMAP client
MIT License
85 stars 39 forks source link

Could run as Docker Container #48

Closed Jantek closed 8 months ago

Jantek commented 9 months ago

Hi,

I just added the functionality to run as docker container. I added a Dockerfile and .dockerignore to build everything and the options could be set via the environment variables like in this docker-compose example:

version: '3.3'

services:
  attachment-downloader:
    image: jantek/attachment-downloader:1.2.7
    environment:
      AD_HOST: xxx
      AD_USERNAME: xxx
      AD_PASSWORD: xxx
      AD_IMAP_FOLDER: INBOX
#      AD_PORT: 
      AD_DOWNLOAD_FOLDER: /output
      AD_INTERVAL: 10
      AD_DELETE: 1
      AD_SENT_TO_REGEX: xxx
    volumes:
      - scans:/output

ADINTERVAL is a new environment variable to stay in a loop inside the docker. The other environment variables are taken from the internal variable names prefixed with 'AD'. See here

The original shell arguments are dominant to the environments.