diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a8f819a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +command.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3061eea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Dockerfile References: https://docs.docker.com/engine/reference/builder/ + +# Start from python:3.9-alpine base image +FROM python:3.9-alpine + +ENV PYTHONFAULTHANDLER=1 \ + PYTHONUNBUFFERED=1 \ + PYTHONHASHSEED=random \ + PIP_NO_CACHE_DIR=off \ + PIP_DISABLE_PIP_VERSION_CHECK=on \ + PIP_DEFAULT_TIMEOUT=100 \ + POETRY_VERSION=1.1.13 + +RUN apk add --no-cache curl +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - + +ENV PATH="/root/.poetry/bin:${PATH}" + +# Make dir app +WORKDIR /app +COPY poetry.lock pyproject.toml /app/ + +# Project initialization: +RUN poetry config virtualenvs.create false \ + && poetry install --no-dev --no-interaction --no-ansi + +# Copy the source from the current directory to the Working Directory inside the container +COPY . /app + +# Run the executable +CMD ["poetry", "run", "python", "mail-forwarder"] \ No newline at end of file diff --git a/mail-forwarder/__main__.py b/mail-forwarder/__main__.py index 85b62a0..644a4e8 100644 --- a/mail-forwarder/__main__.py +++ b/mail-forwarder/__main__.py @@ -79,9 +79,9 @@ for num in msgs[0].split(): smtp.send_message(copied_msg, sender, recipient) print("Message sent.") - print("Sending message to trash...") - imap.store(num, '+FLAGS', '\\Deleted') - print("Message marked for deletion...") + #print("Sending message to trash...") + #imap.store(num, '+FLAGS', '\\Deleted') + #print("Message marked for deletion...") imap.expunge() imap.close() diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..c93bb8f --- /dev/null +++ b/poetry.lock @@ -0,0 +1,8 @@ +package = [] + +[metadata] +lock-version = "1.1" +python-versions = "^3.9" +content-hash = "ce2aa767160f871dd3652615ba0a0dceb7733d62eb8cb4665b87f30a562e3adf" + +[metadata.files] diff --git a/pyproject.toml b/pyproject.toml index 9b3ea04..902c417 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,5 +10,5 @@ python = "^3.9" [tool.poetry.dev-dependencies] [build-system] -requires = ["poetry-core>=1.0.0"] +requires = ["poetry-core>=1.1.13"] build-backend = "poetry.core.masonry.api"