From 2e172d44cce5bcf29a02a4a97b66959be0a0f84d Mon Sep 17 00:00:00 2001 From: dongdigua Date: Mon, 29 May 2023 11:18:04 +0800 Subject: [PATCH] docker: fix git path, add log --- gmi/docker/Dockerfile | 10 +++++++++- gmi/docker/run-wrapper.sh | 5 +++-- gmi/docker/update-git.sh | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gmi/docker/Dockerfile b/gmi/docker/Dockerfile index 6ffe405..6789bdb 100644 --- a/gmi/docker/Dockerfile +++ b/gmi/docker/Dockerfile @@ -2,12 +2,20 @@ FROM alpine:latest RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \ && sed -i 'a https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing' /etc/apk/repositories \ - && apk add agate git + && apk add agate git \ + && touch /var/log/git.log RUN git clone https://github.com/dongdigua/dongdigua.github.io.git --depth 1 COPY run-wrapper.sh . +# https://weinan.io/2019/04/06/cron.html COPY update-git.sh /etc/periotic/daily/ +# for testing purpose only +# RUN mkdir /etc/periodic/1min \ +# && echo "*/1 * * * * run-parts /etc/periodic/1min" \ +# >> /var/spool/cron/crontabs/root +# COPY update-git.sh /etc/periodic/1min/ + CMD [ "./run-wrapper.sh" ] diff --git a/gmi/docker/run-wrapper.sh b/gmi/docker/run-wrapper.sh index 838fcdd..01abaf0 100755 --- a/gmi/docker/run-wrapper.sh +++ b/gmi/docker/run-wrapper.sh @@ -1,7 +1,8 @@ #! /bin/sh -crond -f & -agate --content dongdigua.github.io/gmi --hostname $GEMINI_HOST +crond -f -d 8 & +tail -f /var/log/git.log & +agate --content dongdigua.github.io/gmi -e --hostname $GEMINI_HOST wait -n echo $? diff --git a/gmi/docker/update-git.sh b/gmi/docker/update-git.sh index 234bc81..16cc912 100755 --- a/gmi/docker/update-git.sh +++ b/gmi/docker/update-git.sh @@ -1,4 +1,4 @@ #! /bin/sh -cd dongdigua.github.io -git pull --rebase +cd /dongdigua.github.io +git pull --rebase >> /var/log/git.log 2>&1