From 1d96cafe06cebda60862ef42dbefcdc95785a977 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sat, 22 Oct 2022 21:57:29 +0200 Subject: [PATCH] ci(Dockerfile): Add cron and adapted configuration for automated backups New package (cron) for internal scheduling and edit docker entrypoint to start the daemon accordingly. Backups scheduled every Saturday at 4:00. --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cc6da1..698cdcf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,9 @@ build-image: - echo "RELEASE_PACKAGE=gitlab-ce" >> RELEASE - echo "RELEASE_VERSION=$GITLAB_SHORT_VER-ce" >> RELEASE - echo "DOWNLOAD_URL=http://random.com" >> RELEASE - - sed -i '14 i \ libatomic1 \\' Dockerfile + - sed -i '14 i \ libatomic1 cron \\' Dockerfile + - sed -i '45 i \ \n\# Setup crontab for scheduled backups\nRUN { cat; echo \"0 5 * * 6 gitlab-backup create SKIP=registry,builds,artifacts\"; } | crontab -\n\n' Dockerfile + - sed '/gitlab-ctl reconfigure/a \\nif command -v cron\; then\n\techo \"Starting cron daemon...\"\n\tcron\nfi' assets/wrapper > assets/wrapper - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY/athens-school/gitlab:$GITLAB_SHORT_VER . - docker push $CI_REGISTRY/athens-school/gitlab:$GITLAB_SHORT_VER