tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 96 forks source link

[FEATURE] Add Debian Package cron #515

Closed TheGrumpyBadger closed 1 year ago

TheGrumpyBadger commented 1 year ago

please add installation of the package cron to the Dockerfile.

Reason:

tobybatch commented 1 year ago

Can you provide an example?

Cron will never run the container as it does not run a system supervisor, but I'll bet that the cron tasked are leveraged via commands, so you could use the cron daemon from the host OS like this:

10 23 * * * docker exec kimai /opt/project/bin/console kimai:somecommand
TheGrumpyBadger commented 1 year ago

Our crontab on a VM:

m h dom mon dow command

50 23 1-5 /var/www/kimai2/bin/console hasworked:sendmails 59 23 10 /var/www/kimai2/var/plugins/kimai-export.sh 49 23 * /var/www/kimai2/bin/console kimai:timesheet:stop-all >> /dev/null

On a docker-swarm we have no dedicated host to run docker exec on, so I like to start a second kimai container with the entrypoint 'cron -f'

tobybatch commented 1 year ago

Hmm, interesting. We won't build cron into the base image. It's a small as we can make it. Especially the fpm/alpine one and we get requests to just add xxxx frequently. We'd end up shipping a desktop image.

But you could easily roll your own.

FROM kimai/kimai2:XXXX

RUN apt update && apt install -y cron
ENTRYPOINT /usr/sbin/cron -f