From 6ce52d833cf5922cf860dd2c1a64319f06329483 Mon Sep 17 00:00:00 2001 From: Tudor Date: Tue, 24 Mar 2026 12:40:43 +0000 Subject: [PATCH] fix(kestra): bake flows into kestra-init image to fix empty /flows in container Bind mounts don't work on the remote Portainer host since the files aren't present there. Instead, Dockerfile.init copies the flow YAMLs into a dedicated image (kestra/kestra:latest base) that is built in CI and pulled by Portainer like the other images. Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/build-and-push.yml | 40 ++++++++++++++++++++++++++++- docker-compose.yml | 4 +-- integrator/Dockerfile.init | 3 +++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 integrator/Dockerfile.init diff --git a/.gitea/workflows/build-and-push.yml b/.gitea/workflows/build-and-push.yml index b6600b8..9094ede 100644 --- a/.gitea/workflows/build-and-push.yml +++ b/.gitea/workflows/build-and-push.yml @@ -13,6 +13,7 @@ env: BACKEND_IMAGE_NAME: ${{ gitea.repository }}-backend FRONTEND_IMAGE_NAME: ${{ gitea.repository }}-frontend INTEGRATOR_IMAGE_NAME: ${{ gitea.repository }}-integrator + KESTRA_INIT_IMAGE_NAME: ${{ gitea.repository }}-kestra-init jobs: build-backend: @@ -135,10 +136,47 @@ jobs: cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.INTEGRATOR_IMAGE_NAME }}:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.INTEGRATOR_IMAGE_NAME }}:buildcache,mode=max + build-kestra-init: + name: Build Kestra Init + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Extract metadata for Kestra Init Docker image + id: meta-kestra-init + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.KESTRA_INIT_IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha,prefix=kestra-init- + type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }} + + - name: Build and push Kestra Init Docker image + uses: docker/build-push-action@v5 + with: + context: ./integrator + file: ./integrator/Dockerfile.init + push: ${{ gitea.event_name != 'pull_request' }} + tags: ${{ steps.meta-kestra-init.outputs.tags }} + labels: ${{ steps.meta-kestra-init.outputs.labels }} + trigger-deployment: name: Trigger Portainer Update runs-on: ubuntu-latest - needs: [build-backend, build-frontend, build-integrator] + needs: [build-backend, build-frontend, build-integrator, build-kestra-init] if: gitea.event_name != 'pull_request' steps: - name: Trigger Portainer stack update diff --git a/docker-compose.yml b/docker-compose.yml index 06dfdbb..193f6ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -119,10 +119,8 @@ services: # One-shot container: imports flow YAMLs into Kestra after it's healthy kestra-init: - image: kestra/kestra:latest + image: privaterepo.sitaru.org/tudor/school_compare-kestra-init:latest container_name: schoolcompare_kestra_init - volumes: - - ./integrator/flows:/flows:ro environment: KESTRA_CONFIGURATION: | datasources: diff --git a/integrator/Dockerfile.init b/integrator/Dockerfile.init new file mode 100644 index 0000000..9f24969 --- /dev/null +++ b/integrator/Dockerfile.init @@ -0,0 +1,3 @@ +FROM kestra/kestra:latest +COPY flows/ /flows/ +CMD ["flow", "namespace", "update", "schoolcompare.data", "/flows", "--no-delete"]