generated from coop-cloud/example
Add git-pull functionality 💅
This commit is contained in:
parent
b8dec9d61a
commit
2158fa1fc4
|
@ -9,3 +9,8 @@ COMPOSE_FILE="compose.yml"
|
|||
|
||||
# Single Sign On via Traefik "file provider"
|
||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.sso.yml"
|
||||
|
||||
# Git-pull regularly
|
||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.git-pull.yml"
|
||||
#GIT_REPO_URL="https://git.coopcloud.tech/dalmationer/hexbomb.gay"
|
||||
#CRON_SCHEDULE="*/1 * * * *"
|
||||
|
|
1
abra.sh
1
abra.sh
|
@ -1 +1,2 @@
|
|||
export NGINX_DEFAULT_CONF_VERSION=v1
|
||||
export ENTRYPOINT_CONF_VERSION=v3
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
git:
|
||||
environment:
|
||||
- GIT_REPO_URL
|
||||
image: alpine/git:v2.32.0
|
||||
entrypoint: /docker-entrypoint.sh
|
||||
volumes:
|
||||
- content:/git
|
||||
configs:
|
||||
- source: entrypoint_conf
|
||||
target: /docker-entrypoint.sh
|
||||
mode: 0555
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 0
|
||||
labels:
|
||||
- "swarm.cronjob.enable=true"
|
||||
- "swarm.cronjob.schedule=${CRON_SCHEDULE:-*/5 * * * *}"
|
||||
restart_policy:
|
||||
condition: none
|
||||
|
||||
configs:
|
||||
entrypoint_conf:
|
||||
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
|
||||
file: entrypoint.git-pull.sh
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -d /git/.git ]; then
|
||||
echo "No repo found, emptying /git/ directory"
|
||||
rm -r /git/*
|
||||
echo "Cloning $GIT_REPO_URL into /git"
|
||||
git clone "$GIT_REPO_URL" /git
|
||||
else
|
||||
echo "Updating /git"
|
||||
git pull
|
||||
fi
|
Loading…
Reference in New Issue