mirror of
https://github.com/dongdigua/dongdigua.github.io
synced 2024-11-27 17:10:55 +08:00
docker: working gmid
This commit is contained in:
parent
a49b18355f
commit
6f3ecb076e
@ -2,16 +2,18 @@ FROM alpine:latest
|
|||||||
|
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
|
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 \
|
&& sed -i 'a https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/testing' /etc/apk/repositories \
|
||||||
&& apk add agate git python3 perl \
|
&& apk add gmid git python3 perl \
|
||||||
&& touch /var/log/git.log \
|
&& touch /var/log/git.log \
|
||||||
&& echo "0 * * * * run-parts /etc/periodic/hourly" > /var/spool/cron/crontabs/root
|
&& echo "0 * * * * run-parts /etc/periodic/hourly" > /var/spool/cron/crontabs/root
|
||||||
|
|
||||||
RUN git clone https://github.com/dongdigua/dongdigua.github.io.git --depth 1 \
|
RUN git clone https://github.com/dongdigua/dongdigua.github.io.git --depth 1 \
|
||||||
&& cd dongdigua.github.io \
|
&& cd dongdigua.github.io \
|
||||||
&& git config filter.dater.smudge 'perl -pe "\$last_date = `git log --pretty=format:\\"%ad\\" -1`;s/\\\$Date\\\$/\\\$Date: \$last_date\\\$/"' \
|
&& git config filter.dater.smudge 'perl -pe "\$last_date = `git log --pretty=format:\\"%ad\\" -1`;s/\\\$Date\\\$/\\\$Date: \$last_date\\\$/"' \
|
||||||
&& git config filter.dater.clean 'perl -pe "s/\\\$Date[^\\\$]*\\\$/\\\$Date\\\$/"' \
|
&& git config filter.dater.clean 'perl -pe "s/\\\$Date[^\\\$]*\\\$/\\\$Date\\\$/"'
|
||||||
|
|
||||||
COPY run-wrapper.sh .
|
COPY run-wrapper.sh .
|
||||||
|
COPY gmid.conf /dongdigua.github.io/gmi/docker/
|
||||||
|
COPY cgi/* /dongdigua.github.io/gmi/docker/cgi/
|
||||||
COPY update-git.sh /etc/periodic/hourly/
|
COPY update-git.sh /etc/periodic/hourly/
|
||||||
|
|
||||||
# for testing purpose only
|
# for testing purpose only
|
||||||
|
4
gmi/docker/cgi/stat.cgi
Executable file
4
gmi/docker/cgi/stat.cgi
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#! /usr/bin/sh
|
||||||
|
|
||||||
|
printf "20 text/gemini\r\n";
|
||||||
|
printf "OS: $(uname -rv)\r\nuptime: $(uptime)\r\nserver: $SERVER_SOFTWARE\r\nauth: $AUTH\r\n";
|
12
gmi/docker/genkey.sh
Executable file
12
gmi/docker/genkey.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#! /usr/bin/sh
|
||||||
|
|
||||||
|
if test -f /etc/ssl/gmid.pem; then
|
||||||
|
echo "OK certificate exists"
|
||||||
|
else
|
||||||
|
echo "generating certificate..."
|
||||||
|
apk add libressl
|
||||||
|
libressl req -x509 -newkey rsa:4096 -nodes \
|
||||||
|
-keyout /etc/ssl/private/gmid.key \
|
||||||
|
-out /etc/ssl/gmid.pem \
|
||||||
|
-days 365 -subj "/CN=$GEMINI_HOST"
|
||||||
|
fi
|
9
gmi/docker/gmid.conf
Normal file
9
gmi/docker/gmid.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
server $gem_host {
|
||||||
|
cert "/etc/ssl/gmid.pem"
|
||||||
|
key "/etc/ssl/private/gmid.key"
|
||||||
|
root "/dongdigua.github.io"
|
||||||
|
|
||||||
|
cgi "/cgi/*"
|
||||||
|
default type "text/plain"
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
sh genkey.sh
|
||||||
|
|
||||||
crond -f -d 8 &
|
crond -f -d 8 &
|
||||||
tail -f /var/log/git.log &
|
tail -f /var/log/git.log &
|
||||||
agate -C --content dongdigua.github.io --hostname $GEMINI_HOST
|
gmid -f -c /dongdigua.github.io/gmi/docker/gmid.conf -Dgem_host=$GEMINI_HOST
|
||||||
|
|
||||||
wait -n
|
wait -n
|
||||||
echo $?
|
echo $?
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
cd /dongdigua.github.io
|
cd /dongdigua.github.io
|
||||||
git pull --rebase >> /var/log/git.log 2>&1
|
git pull --rebase >> /var/log/git.log 2>&1
|
||||||
python misc/mdlist2gmi.py > posts.gmi
|
python misc/mdlist2gmi.py > posts.gmi
|
||||||
|
pkill -HUP gmid
|
||||||
|
Loading…
Reference in New Issue
Block a user