commit d79ae8fdd08c8b3af90120ae8f81e00b6764eccc Author: dave Date: Sat Jul 22 13:31:33 2017 -0700 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..064ad86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:xenial + +RUN apt-get update && \ + apt-get install -y wget python3-pip python-pip cron && \ + pip install --upgrade pip && \ + pip3 install --upgrade pip && \ + find /etc/cron* -type f -delete && \ + touch /etc/crontab && \ + useradd ubuntu && \ + rm -rf /var/lib/apt/lists/* + +ADD start /start +ADD crontab /etc/cron.d/base + +RUN chmod +x /start && \ + mkdir -p /srv/cron && \ + touch /srv/cron/crontab + +ENTRYPOINT ["/start"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..9cdc4dd --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +docker-cron +=========== + +Cron in a container. Run any random crap you need. + +The following paths should be added: + +* `/srv/cron/startup` - a script to execute when the container starts +* `/srv/cron/crontab` - /etc/cron.d-style crontab diff --git a/crontab b/crontab new file mode 100644 index 0000000..59b0de9 --- /dev/null +++ b/crontab @@ -0,0 +1,2 @@ +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin diff --git a/start b/start new file mode 100644 index 0000000..2cb3483 --- /dev/null +++ b/start @@ -0,0 +1,9 @@ +#!/bin/bash -eux + +if test -x /srv/cron/startup ; then + /srv/cron/startup +fi + +ln -s /srv/cron/crontab /etc/cron.d/ + +exec cron -f