From d79d4ab12d82b96b233e4591e832372c9178f86a Mon Sep 17 00:00:00 2001 From: devydave Date: Fri, 3 Jul 2026 13:10:52 +0200 Subject: [PATCH] refactor: add seperate entrypoint for plugin init --- abra.sh | 3 ++- compose.yml | 7 +++++++ entrypoint.iocaine.sh.tmpl | 15 +++++++++++++++ entrypoint.sh.tmpl | 10 +--------- 4 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 entrypoint.iocaine.sh.tmpl diff --git a/abra.sh b/abra.sh index 41f8e52..a5356ea 100644 --- a/abra.sh +++ b/abra.sh @@ -1,3 +1,4 @@ export TRAEFIK_YML_VERSION=v32 export FILE_PROVIDER_YML_VERSION=v13 -export ENTRYPOINT_VERSION=v6 +export ENTRYPOINT_VERSION=v7 +export IOCAINE_ENTRYPOINT_VERSION=v1 diff --git a/compose.yml b/compose.yml index e4c44fa..a8e9c56 100644 --- a/compose.yml +++ b/compose.yml @@ -27,6 +27,9 @@ services: - source: entrypoint target: /custom-entrypoint.sh mode: 0555 + - source: iocaine_entrypoint + target: /entrypoint.iocaine.sh + mode: 0555 networks: - proxy - internal @@ -115,6 +118,10 @@ configs: name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} file: entrypoint.sh.tmpl template_driver: golang + iocaine_entrypoint: + name: ${STACK_NAME}_entrypoint_${IOCAINE_ENTRYPOINT_VERSION} + file: entrypoint.iocaine.sh.tmpl + template_driver: golang volumes: letsencrypt: diff --git a/entrypoint.iocaine.sh.tmpl b/entrypoint.iocaine.sh.tmpl new file mode 100644 index 0000000..1fa8e06 --- /dev/null +++ b/entrypoint.iocaine.sh.tmpl @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +apk --no-cache add git go +iocaine_path="/plugins-local/src/git.mstar.dev/mstar/traefik-iocaine-middleware" +if [ ! -d "$iocaine_path" ]; then + git clone --depth 1 --branch $IOCAINE_PLUGIN_VERSION https://git.mstar.dev/mstar/traefik-iocaine-middleware.git $iocaine_path +else + git -C $iocaine_path fetch origin 'refs/tags/*:refs/tags/*' + git -C $iocaine_path checkout tags/$IOCAINE_PLUGIN_VERSION +fi +(cd $iocaine_path && go mod vendor) + +exit 0 diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index d930f78..11cd593 100644 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -16,15 +16,7 @@ export AZURE_CLIENT_SECRET=$(cat "$AZURE_CLIENT_SECRET_FILE") {{ end }} {{ if eq (env "IOCAINE_ENABLE") "1" }} -apk --no-cache add git go -iocaine_path="/plugins-local/src/git.mstar.dev/mstar/traefik-iocaine-middleware" -if [ ! -d "$iocaine_path" ]; then - git clone --depth 1 --branch $IOCAINE_PLUGIN_VERSION https://git.mstar.dev/mstar/traefik-iocaine-middleware.git $iocaine_path -else - git -C $iocaine_path fetch origin 'refs/tags/*:refs/tags/*' - git -C $iocaine_path checkout tags/$IOCAINE_PLUGIN_VERSION -fi -(cd $iocaine_path && go mod vendor) +/entrypoint.iocaine.sh {{ end }} /entrypoint.sh "$@"