You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
991 B
Bash

#!/bin/sh
4 years ago
# import trusted fingerprints
mkdir "$HOME/.ssh"
echo "$SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
# use a custom ssh key for git
export GIT_SSH_COMMAND="ssh -i ""$SSH_PRIVATE_KEY"""
# update swarm-nat
# use docker.io/lubiland/swarm-nat until registry.lubiland.de allows public access
docker pull docker.io/lubiland/swarm-nat
4 years ago
while :; do
# check if the git repository already got cloned
if [ -d .git ]; then
# update the git repository
git pull
else
# no repository found; do an initial clone
git clone "$REPOSITORY" .
fi
# run the actual swarm-nat docker container
# use docker instead of running it directly to use --cap-add
# use docker.io/lubiland/swarm-nat until registry.lubiland.de allows public access
docker run --rm --net=host --cap-add=NET_ADMIN --volume /var/run/docker.sock:/var/run/docker.sock --volume /cephfs/lubiland-lubinat/lubidock/stacks:/stacks docker.io/lubiland/swarm-nat
4 years ago
sleep 60
done