init
commit
68327b5660
|
@ -0,0 +1,14 @@
|
|||
FROM debian:11
|
||||
RUN apt-get update
|
||||
RUN apt-get dist-upgrade
|
||||
RUN apt-get install -y git apache2 rsync wget supervisor
|
||||
WORKDIR /tmp
|
||||
RUN wget https://github.com/gohugoio/hugo/releases/download/v0.111.3/hugo_extended_0.111.3_linux-amd64.deb
|
||||
RUN dpkg -i hugo_*_linux-amd64.deb
|
||||
RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd /var/log/supervisor
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY builder /usr/local/bin/builder
|
||||
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["/usr/bin/supervisord"]
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
REPO="https://git.c3re.de/c3re/test-website.git"
|
||||
|
||||
refresh() {
|
||||
cd
|
||||
|
||||
test -d site/.git || {
|
||||
test -d site && rm -rf site
|
||||
git clone --recursive "$REPO" site
|
||||
|
||||
}
|
||||
|
||||
cd site
|
||||
git pull
|
||||
# iterate over all branches and checkout that branch
|
||||
for branch in $(git branch -a | grep remotes | grep -v HEAD); do
|
||||
branch=${branch#remotes/origin/}
|
||||
git checkout "$branch"
|
||||
git pull
|
||||
git reset --hard
|
||||
hugo
|
||||
mkdir -p /var/www/html/"$branch"
|
||||
rsync -avz --delete public/* /var/www/html/"$branch"/
|
||||
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
while true; do
|
||||
sleep 60 &
|
||||
|
||||
refresh
|
||||
|
||||
wait
|
||||
|
||||
done
|
|
@ -0,0 +1,8 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:builder]
|
||||
command=/usr/local/bin/builder
|
||||
|
||||
[program:apache2]
|
||||
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
|
Reference in New Issue