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..9ea96a58ddd4323b655cc37a77b98890fe63307d --- /dev/null +++ b/crond/README.md @@ -0,0 +1,20 @@ +# crond + +> Cron container image. + +## Description + +This container periodically runs the [docker-clean +image](https://hub.docker.com/r/adarnimrod/docker-clean). For this the `dockerd` +socket is bind mounted to this container. + +## 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://git.shore.co.il/nimrod/>. diff --git a/crond/crontab b/crond/crontab new file mode 100644 index 0000000000000000000000000000000000000000..022e85b3ad43374dc025d4f7aebe401440f93ed3 --- /dev/null +++ b/crond/crontab @@ -0,0 +1 @@ +@daily docker run --rm --name=docker-clean --volume /var/run/docker.sock:/var/run/docker.sock adarnimrod/docker-clean diff --git a/docker-compose.yml b/docker-compose.yml index 19064d6739293825b5db89e6ac54a838829147a8..cf7492b7e86bb3a0fa91d8a54dcac38cdca6bb63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,11 @@ services: volumes: - config:/etc/gitlab-runner - /var/run/docker.sock:/var/run/docker.sock + crond: + build: + context: crond/ + volumes: + - /run/docker.sock:/run/docker.sock volumes: config: