init
This commit is contained in:
commit
77640cb234
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from docker.io/library/python:3.11-alpine
|
||||||
|
|
||||||
|
RUN mkdir /usr/local/app
|
||||||
|
WORKDIR /usr/local/app
|
||||||
|
|
||||||
|
COPY entrypoint.sh /
|
||||||
|
ENTRYPOINT /entrypoint.sh
|
||||||
|
|
||||||
|
COPY sync-content.sh /usr/local/bin/
|
||||||
|
|
||||||
|
RUN apk add --no-cache git make rclone
|
3
build.sh
Executable file
3
build.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
docker build --network host . -t docker.io/jeancloud/pelican-rclone-builder
|
||||||
|
docker push jeancloud/pelican-rclone-builder:latest
|
11
entrypoint.sh
Executable file
11
entrypoint.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
[ -d .git ] || git clone "$GIT_SOURCE_REPO" .
|
||||||
|
[ -d venv ] || python -m venv venv
|
||||||
|
. venv/bin/activate
|
||||||
|
pip install --upgrade pip
|
||||||
|
git pull --rebase
|
||||||
|
pip install -r requirements.txt
|
||||||
|
sync-content.sh
|
||||||
|
make html
|
17
sync-content.sh
Executable file
17
sync-content.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ -f .env ] && . ./.env
|
||||||
|
|
||||||
|
[ -z "$CLOUD_SERVER" ] && echo 'Aucun serveur cloud trouvé' && exit 0
|
||||||
|
[ -z "$CLOUD_PASSWORD" ] && echo "Aucun mot de passe trouvé" && exit 1
|
||||||
|
|
||||||
|
action="$1"
|
||||||
|
|
||||||
|
if [ "$action" = 'pull' ] || [ -z "$action" ] ; then
|
||||||
|
rclone sync --webdav-url="$CLOUD_SERVER/remote.php/webdav/" --webdav-vendor=nextcloud --webdav-user="$CLOUD_USER" --webdav-pass=$(rclone obscure $CLOUD_PASSWORD) :webdav:"$CLOUD_REMOTE_PATH" "$CLOUD_LOCAL_PATH"
|
||||||
|
elif [ "$action" = 'push' ] ; then
|
||||||
|
rclone sync --webdav-url="$CLOUD_SERVER/remote.php/webdav/" --webdav-vendor=nextcloud --webdav-user="$CLOUD_USER" --webdav-pass=$(rclone obscure $CLOUD_PASSWORD) "$CLOUD_LOCAL_PATH" :webdav:"$CLOUD_REMOTE_PATH"
|
||||||
|
else
|
||||||
|
echo "unknown action: $action"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user