diff --git a/crond/.dockerignore b/crond/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..780ece0ba38bebbc9981d893ff31ffc6cb6815e2 --- /dev/null +++ b/crond/.dockerignore @@ -0,0 +1,2 @@ +* +!crontab diff --git a/crond/Dockerfile b/crond/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..994fbce7b5c680497c7a0744376b361f2404b2a6 --- /dev/null +++ b/crond/Dockerfile @@ -0,0 +1,8 @@ +FROM docker:19.03 as docker + +# hadolint ignore=DL3006 +FROM adarnimrod/cron as supersonic +COPY --from=docker /usr/local/bin/docker /usr/local/bin/ +COPY --chown=root:root crontab /crontab +# hadolint ignore=DL3002 +USER root diff --git a/crond/README.md b/crond/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4076d73bf343aff0a1efb681c3611f180c006970 --- /dev/null +++ b/crond/README.md @@ -0,0 +1,21 @@ +# crond + +> Cron container image. + +## Description + +This container periodically runs the slapd backup script. The script runs in the +slapd container so the `dockerd` socket is bind mounted to this container and +the commands are executed via `docker exec` in the other containers. Thus, +outside of the context of this setup this container doesn't make much sense. + +## License + +This software is licensed under the MIT license (see `LICENSE.txt`). + +## Author Information + +Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website]( +https://www.shore.co.il/). Patches are welcome via [`git send-email`]( +http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located +at: <https://www.shore.co.il/git/>. diff --git a/crond/crontab b/crond/crontab new file mode 100644 index 0000000000000000000000000000000000000000..0534b1648514454915661bd696804a4af0c5413a --- /dev/null +++ b/crond/crontab @@ -0,0 +1 @@ +@daily docker exec ldap_ldap_1 backup diff --git a/docker-compose.yml b/docker-compose.yml index c7b435137d8a66d63a257b928861e95026b8d681..5aab8144a4480f1a442460ca41c1978e731cd797 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,12 @@ --- version: '3.5' services: + crond: + build: + context: crond/ + volumes: + - /run/docker.sock:/run/docker.sock + ldap: build: cache_from: