Skip to content
Snippets Groups Projects
Commit b19433c5 authored by Dmitriy Safronov's avatar Dmitriy Safronov
Browse files

rsync_webhoook

parent 5de813e4
Branches
No related tags found
No related merge requests found
......@@ -3,13 +3,17 @@ FROM registry.cyberbrain.pw/docker/git-sync:latest
ENV GIT_SYNC_ROOT='/tmp/git' \
GIT_SYNC_DEST='sync' \
GIT_SYNC_EXECHOOK_COMMAND='/rsync-sync' \
GIT_SYNC_ADD_USER='true'
GIT_SYNC_ADD_USER='true' \
RSYNC_SYNC_WEBHOOK_METHOD='POST' \
RSYNC_SYNC_WEBHOOK_TIMEOUT=1 \
RSYNC_SYNC_WEBHOOK_BACKOFF=3 \
RSYNC_SYNC_WEBHOOK_ATTEMPTS=3
USER root:root
RUN set -ex \
&& apt-get update -y \
&& apt-get install --no-install-recommends -y rsync \
&& apt-get install --no-install-suggests --no-install-recommends -y rsync curl \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& chmod -Rv 0777 "${GIT_SYNC_ROOT:-/tmp/git}/"
......
......@@ -11,3 +11,10 @@ Preset env vars:
- GIT_SYNC_DEST='sync'
- GIT_SYNC_EXECHOOK_COMMAND='/rsync-sync'
- GIT_SYNC_ADD_USER='true'
- RSYNC_SYNC_WEBHOOK_METHOD='POST'
- RSYNC_SYNC_WEBHOOK_TIMEOUT=1
- RSYNC_SYNC_WEBHOOK_BACKOFF=3
- RSYNC_SYNC_WEBHOOK_ATTEMPTS=3
Custom env vars:
- RSYNC_SYNC_WEBHOOK_URL
......@@ -6,3 +6,12 @@ rsync -a \
--delete-after \
"${GIT_SYNC_ROOT:-/tmp/git}/${GIT_SYNC_DEST:-sync}/" \
/sync
if test -n "${RSYNC_SYNC_WEBHOOK_URL}"; then
curl -I -L \
-X ${RSYNC_SYNC_WEBHOOK_METHOD:-POST} \
-m ${RSYNC_SYNC_WEBHOOK_TIMEOUT:-1} \
--retry ${RSYNC_SYNC_WEBHOOK_ATTEMPTS:-3} \
--retry-delay ${RSYNC_SYNC_WEBHOOK_BACKOFF:-3} \
"${RSYNC_SYNC_WEBHOOK_URL}"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment