diff --git a/.gitignore b/.gitignore index 88f27af..e952a18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea *.iml -config.json \ No newline at end of file +home_dir diff --git a/Dockerfile b/Dockerfile index e10cd5a..6205966 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,9 @@ FROM library/alpine:3.5 ENV HOME_DIR=/opt/crontab -RUN apk add --no-cache --virtual .run-deps bash curl jq docker \ +RUN apk add --no-cache --virtual .run-deps bash curl jq \ && mkdir -p ${HOME_DIR} -# Dev -#COPY config.json ${HOME_DIR}/ - COPY docker-entrypoint / ENTRYPOINT ["/docker-entrypoint"] diff --git a/README.md b/README.md index 950ac23..0a2ce30 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # docker-crontab -A simple wrapper over `docker` to all complex cron job to be run in other containers. +A simple wrapper over `docker` to all complex cron job to be run in other containers. All in <45MB. ## Supported tags and Dockerfile links @@ -10,7 +10,7 @@ A simple wrapper over `docker` to all complex cron job to be run in other contai ## Why? -Yes, I'm aware of [mcuadros/ofelia](https://github.com/mcuadros/ofelia), it was the main inspiration for this project. +Yes, I'm aware of [mcuadros/ofelia](https://github.com/mcuadros/ofelia) (280MB), it was the main inspiration for this project. A great project, don't get me wrong. It was just missing certain key enterprise features I felt were required to support where docker is heading. ## Features @@ -40,6 +40,8 @@ See `./config.sample.json` for examples. docer build -t crontab . docker run -d \ -v /var/run/docker.sock:/var/run/docker.sock \ + -v /usr/bin/docker:/usr/bin/docker \ + -v /path/to/config/dir:/opt/crontab \ crontab ``` diff --git a/docker-compose.yml b/docker-compose.yml index 888fc59..bc3a6ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,3 +11,5 @@ services: restart: always volumes: - "/var/run/docker.sock:/var/run/docker.sock" + - "/usr/bin/docker:/usr/bin/docker" + - "/Users/willfarrell/Development/docker/crontab/home_dir:/opt/crontab" diff --git a/docker-entrypoint b/docker-entrypoint index ed29632..2874d54 100755 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -156,8 +156,12 @@ function build_crontab() { # Used to pass json to functions - total hack, I know TMP_JSON= -if [ "$1" = "crond" ] && [ -f ${CONFIG} ]; then - build_crontab +if [ "$1" = "crond" ]; then + if [ -f ${CONFIG} ]; then + build_crontab + else + echo "Unable to find ${HOME_DIR}/config.json" + fi fi echo "$@"