Changes base image to python2 + adds SSL config option to imapgrab cmds

This commit is contained in:
Maximilian Kratz 2024-09-15 11:15:51 +02:00
parent d3189f8b05
commit fa9cbc86a9

View file

@ -1,5 +1,5 @@
# Use ubuntu 24.04
FROM ubuntu:24.04
# Use python:2
FROM python:2
LABEL maintainer="Max Kratz <account@maxkratz.com>"
ENV DEBIAN_FRONTEND=noninteractive
@ -18,20 +18,20 @@ RUN sudo locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
# Install specific packages
RUN sudo apt-get install -y getmail6 python3
RUN sudo apt-get install -y getmail
RUN sudo git clone https://github.com/ralbear/IMAPbackup.git
# Remove apt lists (for storage efficiency)
RUN sudo rm -rf /var/lib/apt/lists/*
# Run list command
# RUN cd IMAPbackup && sudo python3 imapgrab.py -l -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD
# RUN cd IMAPbackup && sudo python2 imapgrab.py --ssl -l -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD
# Assuming that folder is mount to /mnt, create mail-output folder
RUN sudo mkdir -p /mnt/mail
# Check if logging is enabled
CMD if [ "${MAILLOG}" = "TRUE" ]; \
then sudo mkdir -p /mnt/log && cd IMAPbackup && sudo python3 imapgrab.py -L imapgrab -d -v -M -f /mnt/mail/$MAILFOLDER -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD -m "_ALL_" >> /mnt/log/$(date +'%Y-%m-%d_%H-%M-%S')_mail-backup.log; \
else cd IMAPbackup && sudo python3 imapgrab.py -L imapgrab -d -v -M -f /mnt/mail/$MAILFOLDER -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD -m "_ALL_"; \
then sudo mkdir -p /mnt/log && cd IMAPbackup && sudo python2 imapgrab.py --ssl -L imapgrab -d -v -M -f /mnt/mail/$MAILFOLDER -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD -m "_ALL_" >> /mnt/log/$(date +'%Y-%m-%d_%H-%M-%S')_mail-backup.log; \
else cd IMAPbackup && sudo python2 imapgrab.py --ssl -L imapgrab -d -v -M -f /mnt/mail/$MAILFOLDER -s $MAILHOST -u $MAILUSER -p $MAILPASSWORD -m "_ALL_"; \
fi