FROM alpine

###################################################### Update APK #######################################################
RUN apk update
###################################################### Install zip mailx & cron #######################################################
RUN apk add --update \
        mysql-client \
        zip \
        bash \
        curl \
        openssl \
        heirloom-mailx \
	postgresql \
	postgresql-client

#################################################### Setting up backups ####################################################
ADD backup.sh /backup.sh
RUN chmod u+x /backup.sh

RUN touch /var/log/cron.log

RUN echo "0 8 * * 1 bash /backup.sh >> /var/log/cron.log 2>&1 \n\
" >> /crontab.txt
RUN /usr/bin/crontab /crontab.txt

#################################################### Setting up cron ####################################################
CMD /usr/sbin/crond && tail -f /var/log/cron.log
