From 0876eecf50c34adb279c68fd9a680d320ed8844c Mon Sep 17 00:00:00 2001 From: Cedric Hornberger Date: Sun, 10 May 2026 21:27:28 +0200 Subject: [PATCH] ci: improve dev pipeline with Dokploy webhook and Docker layer caching --- .gitea/workflows/build.yml | 58 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 0aa927d..e2dfadd 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -12,43 +12,45 @@ jobs: steps: # 1. Checkout the code - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - # 2. Set up Java and Maven + # 2. Set up Java and Maven (includes Maven, no separate install needed) - name: Set up JDK (Eclipse Temurin) - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: "temurin" java-version: "17" cache: maven - # 3. Verify Maven installation - - name: Install Maven - run: | - sudo apt-get update - sudo apt-get install -y maven - mvn -version - - # 4. Build the Spring Boot application + # 3. Build the Spring Boot application - name: Build Spring Boot Application - run: | - mvn clean package -DskipTests + run: mvn clean package -DskipTests - # 5. Set up Docker - - name: Set up Docker - run: | - docker --version + # 4. Set up Docker Buildx (enables layer caching) + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - # 6. Build the Docker image - - name: Build and Package Docker Image - run: | - docker build -t tea.zendric.de/cedric/xpensely-server:latest . - - # 7. Docker login + # 5. Docker login - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: tea.zendric.de + username: ${{ secrets.TEAUSER }} + password: ${{ secrets.TEAPASSWORD }} + + # 6. Build and push Docker image with layer caching + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: tea.zendric.de/cedric/xpensely-server:latest + cache-from: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache + cache-to: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache,mode=max + + # 7. Trigger Dokploy to redeploy the dev server automatically + - name: Trigger Dokploy Redeploy run: | - echo "${{ secrets.TEAPASSWORD }}" | docker login tea.zendric.de -u ${{ secrets.TEAUSER }} --password-stdin - # 8. Push Docker image - - name: Push the Docker Image to registry - run: | - docker push tea.zendric.de/cedric/xpensely-server:latest + curl -X POST "${{ secrets.DOKPLOY_WEBHOOK_URL }}" \ + -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ + --fail