First working version

This commit is contained in:
Dennis Schwerdel
2020-11-12 12:01:14 +01:00
commit d08ff0c7ef
20 changed files with 366 additions and 0 deletions

33
rebuild.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -eu
REPO_PATH=/run/repo
WEB_PATH=/run/html
. /app/data/config.sh
if [ "$REPO_URL" == "" ]; then
echo "No REPO_URL set!"
exit 1
fi
if ! [ -d "$REPO_PATH" ]; then
git clone "$REPO_URL" "$REPO_PATH"
(cd "$REPO_PATH" && git submodule init)
fi
cd "$REPO_PATH"
git pull
git submodule update
zola build
echo "Compressing files..."
find public -type f -name '*.css' -size +5k -exec zopfli '{}' \;
find public -type f -name '*.js' -size +5k -exec zopfli '{}' \;
find public -type f -name '*.html' -size +5k -exec zopfli '{}' \;
echo "Updating webpage..."
mkdir -p "$WEB_PATH"
rsync -av --del public/ "$WEB_PATH/"