Compare commits
6 Commits
c5cd522a22
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 683789fa5f | |||
| 737b529b8d | |||
| 682960d450 | |||
| e4e6da1bca | |||
| 4c22604a83 | |||
| 0d7b92f3d2 |
@@ -31,6 +31,10 @@ If you specify a SSH URL (`ssh:// ...`) for your repository, the host key will b
|
||||
|
||||
If you want to pull private repositories, you may need to generate a SSH key for this purpose, and hand in the private key file, e.g. via `-v ./id_rsa:/root/.ssh/id_rsa`.
|
||||
|
||||
#### Specify branch
|
||||
|
||||
If there is a specific branch to use (other than [master/main](https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/)), you can specify the desired branch using the `REPO_BRANCH` environment variable.
|
||||
|
||||
### Passthrough via Bind
|
||||
|
||||
To just use a specific directory as the hugo blog contents, run the container with the repository passed through as bind directory:
|
||||
|
||||
+14
-4
@@ -15,12 +15,22 @@ set -e -v
|
||||
true
|
||||
else
|
||||
# repo URL set
|
||||
if [ -d /repo ]; then
|
||||
# repo already exists, try to pull
|
||||
cd /repo && git pull --recurse-submodules
|
||||
if [ "$?" -ne 0 ]; then
|
||||
# pull failed, clean and retry to clone
|
||||
echo "Pull failed, attempting to clean clone"
|
||||
rm -rf /repo
|
||||
fi
|
||||
fi
|
||||
if [ ! -d /repo ]; then
|
||||
# repo needs to be cloned
|
||||
git clone --recurse-submodules $REPO_URL /repo
|
||||
else
|
||||
# no - pull existing repo
|
||||
cd /repo && git pull --recurse-submodules
|
||||
# check if there is a specific branch to clone
|
||||
if [ ! "$REPO_BRANCH" == "" ]; then
|
||||
BRANCHCMD="--branch $REPO_BRANCH"
|
||||
fi
|
||||
git clone --recurse-submodules $BRANCHCMD $REPO_URL /repo
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
+3
-1
@@ -9,7 +9,9 @@ if [ "$BUILDFREQ" == "" ]; then
|
||||
fi
|
||||
|
||||
# Run the pull script regularly
|
||||
echo "$BUILDFREQ * * * * /aux/pull-n-build.sh" >> /var/spool/cron/crontabs/root
|
||||
target="/aux/pull-n-build.sh"
|
||||
entry="*/$BUILDFREQ * * * * $target"
|
||||
grep "$target" /var/spool/cron/crontabs/root || echo "$entry" >> /var/spool/cron/crontabs/root
|
||||
|
||||
# start cron daemon (goes into background)
|
||||
crond
|
||||
|
||||
Reference in New Issue
Block a user