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..3d39d79f2356651bf3faa0550d343e727c574768 --- /dev/null +++ b/crond/Dockerfile @@ -0,0 +1,6 @@ +# hadolint ignore=DL3006 +FROM registry.shore.co.il/cron as supersonic +# hadolint ignore=DL3002 +USER root +# hadolint ignore=DL3018 +RUN apk add --update --no-cache docker-cli diff --git a/crond/README.md b/crond/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7a0e8955c1204388c563e8f3aaac7d8a2ae11951 --- /dev/null +++ b/crond/README.md @@ -0,0 +1,20 @@ +# crond + +> Cron container image. + +## Description + +Periodically run the registry's garbage collection. It should be improved to +first put the registry in a read-only mode or disable the Nginx proxy or +something. + +## 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/explore/>. diff --git a/crond/crontab b/crond/crontab new file mode 100644 index 0000000000000000000000000000000000000000..de221d824943057b83e6d653c0dada91227d293b --- /dev/null +++ b/crond/crontab @@ -0,0 +1 @@ +@weekly docker exec registry_registry_1 registry garbage-collect /etc/docker/registry/config.yml diff --git a/docker-compose.yml b/docker-compose.yml index 60463f036ebe8a0f7485c407e688e7e1f637c84c..df05d1a69f5400c63791c5a942ee8ae0a798bfe8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: restart: always volumes: - "registry:/var/lib/registry" + reg: command: - "server" @@ -34,6 +35,13 @@ services: image: r.j3ss.co/reg:v0.16.1 restart: always + crond: + build: + context: crond/ + restart: always + volumes: + - /run/docker.sock:/run/docker.sock + volumes: registry: