This commit is contained in:
Alex 2024-08-04 11:58:39 -04:00
parent 62477be9e5
commit 886290f906
5 changed files with 44 additions and 4 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
command.sh

31
Dockerfile Normal file
View File

@ -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"]

View File

@ -79,9 +79,9 @@ for num in msgs[0].split():
smtp.send_message(copied_msg, sender, recipient) smtp.send_message(copied_msg, sender, recipient)
print("Message sent.") print("Message sent.")
print("Sending message to trash...") #print("Sending message to trash...")
imap.store(num, '+FLAGS', '\\Deleted') #imap.store(num, '+FLAGS', '\\Deleted')
print("Message marked for deletion...") #print("Message marked for deletion...")
imap.expunge() imap.expunge()
imap.close() imap.close()

8
poetry.lock generated Normal file
View File

@ -0,0 +1,8 @@
package = []
[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "ce2aa767160f871dd3652615ba0a0dceb7733d62eb8cb4665b87f30a562e3adf"
[metadata.files]

View File

@ -10,5 +10,5 @@ python = "^3.9"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.1.13"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"