From 9e0b9d27c1855b1834963c1869551dd7c00ef099 Mon Sep 17 00:00:00 2001 From: Sky Leite Date: Sat, 7 Jan 2023 15:46:59 -0300 Subject: [PATCH] Add ability to build plugins with a top-level Dockerfile --- .github/workflows/build-plugins.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-plugins.yml b/.github/workflows/build-plugins.yml index a591e09e..6d8fc083 100644 --- a/.github/workflows/build-plugins.yml +++ b/.github/workflows/build-plugins.yml @@ -94,7 +94,28 @@ jobs: unset $IFS echo "${sorted[@]}" echo edited_files=${sorted[@]} >> $GITHUB_OUTPUT - + + - name: Build plugins with top-level Dockerfiles + id: build-top-level + run: | + pushd plugins + TO_BUILD_PLUGINS=$(find . -maxdepth 2 -name "Dockerfile" -exec dirname {} \;) + for plugin in $TO_BUILD_PLUGINS; do + echo $plugin + + # Pretend to sanitize the directory name. Should improve this later + sane_plugin_name=$(basename $plugin) + output=/tmp/output-top-level/$sane_plugin_name + + # Build plugin's top-level Dockerfile + docker build -f $plugin/Dockerfile -t $sane_plugin_name $plugin + docker run --rm -v $output:/output $sane_plugin_name + + # Replace current plugin directory with built one from Docker + rm -r $plugin + cp -r $output . + done + - name: Build plugin backends run: | IFS=' ' read -ra files <<< "${{ steps.list-files.outputs.edited_files }}"