mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-07 17:07:09 +00:00
feat(): add Docker entrypoint
This allows to pre-fetch scripts form a GIT repository.
This commit is contained in:
parent
b9e5bbaeae
commit
4b586772ae
|
@ -40,6 +40,9 @@ RUN apk add --no-cache git openssh-client jq
|
|||
# Install binary and default scripts
|
||||
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/release/$ARTIFACT-linux-amd64 /usr/local/bin/$ARTIFACT
|
||||
COPY --from=builder /go/src/$REPOSITORY/$ARTIFACT/scripts /opt/scripts
|
||||
COPY docker-entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
# Define command
|
||||
CMD webhookd
|
||||
|
|
21
docker-entrypoint.sh
Executable file
21
docker-entrypoint.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Error function
|
||||
die() { echo "error: $@" 1>&2 ; exit 1; }
|
||||
|
||||
if [ ! -z "$APP_SCRIPTS_GIT_URL" ]
|
||||
then
|
||||
[ ! -f "$APP_SCRIPTS_GIT_KEY" ] && die "Git clone key not found."
|
||||
|
||||
export APP_SCRIPTS_DIR=${APP_SCRIPTS_DIR:-/opt/scripts-git}
|
||||
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||
|
||||
mkdir -p $APP_SCRIPTS_DIR
|
||||
|
||||
echo "Cloning $APP_SCRIPTS_GIT_URL into $APP_SCRIPTS_DIR ..."
|
||||
ssh-agent sh -c 'ssh-add ${APP_SCRIPTS_GIT_KEY}; git clone --depth 1 --single-branch ${APP_SCRIPTS_GIT_URL} ${APP_SCRIPTS_DIR}'
|
||||
[ $? != 0 ] && die "Unable to clone repository"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user