feat(ci): add Docker build jobs for presi and storage apps

Add CI/CD pipeline support for:
- presi-backend, presi-web
- storage-backend, storage-web

Includes:
- Change detection for selective builds
- Multi-platform builds (amd64/arm64)
- GitHub Container Registry push

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-25 14:17:48 +01:00
parent 8ff8cd5edf
commit 409f9a0766

View file

@ -61,6 +61,10 @@ jobs:
clock-web: ${{ steps.changes.outputs.clock-web }}
contacts-backend: ${{ steps.changes.outputs.contacts-backend }}
contacts-web: ${{ steps.changes.outputs.contacts-web }}
presi-backend: ${{ steps.changes.outputs.presi-backend }}
presi-web: ${{ steps.changes.outputs.presi-web }}
storage-backend: ${{ steps.changes.outputs.storage-backend }}
storage-web: ${{ steps.changes.outputs.storage-web }}
telegram-stats-bot: ${{ steps.changes.outputs.telegram-stats-bot }}
any-changes: ${{ steps.changes.outputs.any-changes }}
steps:
@ -87,6 +91,10 @@ jobs:
echo "clock-web=true" >> $GITHUB_OUTPUT
echo "contacts-backend=true" >> $GITHUB_OUTPUT
echo "contacts-web=true" >> $GITHUB_OUTPUT
echo "presi-backend=true" >> $GITHUB_OUTPUT
echo "presi-web=true" >> $GITHUB_OUTPUT
echo "storage-backend=true" >> $GITHUB_OUTPUT
echo "storage-web=true" >> $GITHUB_OUTPUT
echo "telegram-stats-bot=true" >> $GITHUB_OUTPUT
echo "any-changes=true" >> $GITHUB_OUTPUT
exit 0
@ -117,6 +125,10 @@ jobs:
echo "clock-web=true" >> $GITHUB_OUTPUT
echo "contacts-backend=true" >> $GITHUB_OUTPUT
echo "contacts-web=true" >> $GITHUB_OUTPUT
echo "presi-backend=true" >> $GITHUB_OUTPUT
echo "presi-web=true" >> $GITHUB_OUTPUT
echo "storage-backend=true" >> $GITHUB_OUTPUT
echo "storage-web=true" >> $GITHUB_OUTPUT
echo "telegram-stats-bot=true" >> $GITHUB_OUTPUT
echo "any-changes=true" >> $GITHUB_OUTPUT
exit 0
@ -245,6 +257,38 @@ jobs:
echo "contacts-web=false" >> $GITHUB_OUTPUT
fi
# presi-backend
PRESI_BACKEND_CHANGED=$(check_pattern "apps/presi/apps/backend/|apps/presi/packages/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$PRESI_BACKEND_CHANGED" == "true" ]; then
echo "presi-backend=true" >> $GITHUB_OUTPUT
else
echo "presi-backend=false" >> $GITHUB_OUTPUT
fi
# presi-web
PRESI_WEB_CHANGED=$(check_pattern "apps/presi/apps/web/|apps/presi/packages/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$SHARED_UI_CHANGED" == "true" ] || [ "$SHARED_WEB_CHANGED" == "true" ] || [ "$PRESI_WEB_CHANGED" == "true" ]; then
echo "presi-web=true" >> $GITHUB_OUTPUT
else
echo "presi-web=false" >> $GITHUB_OUTPUT
fi
# storage-backend
STORAGE_BACKEND_CHANGED=$(check_pattern "apps/storage/apps/backend/|apps/storage/packages/|packages/shared-storage/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$STORAGE_BACKEND_CHANGED" == "true" ]; then
echo "storage-backend=true" >> $GITHUB_OUTPUT
else
echo "storage-backend=false" >> $GITHUB_OUTPUT
fi
# storage-web
STORAGE_WEB_CHANGED=$(check_pattern "apps/storage/apps/web/|apps/storage/packages/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$SHARED_UI_CHANGED" == "true" ] || [ "$SHARED_WEB_CHANGED" == "true" ] || [ "$STORAGE_WEB_CHANGED" == "true" ]; then
echo "storage-web=true" >> $GITHUB_OUTPUT
else
echo "storage-web=false" >> $GITHUB_OUTPUT
fi
# telegram-stats-bot
TELEGRAM_STATS_BOT_CHANGED=$(check_pattern "services/telegram-stats-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$TELEGRAM_STATS_BOT_CHANGED" == "true" ]; then
@ -278,6 +322,10 @@ jobs:
echo "| clock-web | ${{ steps.changes.outputs.clock-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| contacts-backend | ${{ steps.changes.outputs.contacts-backend }} |" >> $GITHUB_STEP_SUMMARY
echo "| contacts-web | ${{ steps.changes.outputs.contacts-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| presi-backend | ${{ steps.changes.outputs.presi-backend }} |" >> $GITHUB_STEP_SUMMARY
echo "| presi-web | ${{ steps.changes.outputs.presi-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| storage-backend | ${{ steps.changes.outputs.storage-backend }} |" >> $GITHUB_STEP_SUMMARY
echo "| storage-web | ${{ steps.changes.outputs.storage-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| telegram-stats-bot | ${{ steps.changes.outputs.telegram-stats-bot }} |" >> $GITHUB_STEP_SUMMARY
# ===========================================
@ -666,6 +714,122 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-presi-backend:
name: Build presi-backend
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.presi-backend == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/presi-backend
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: apps/presi/apps/backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-presi-web:
name: Build presi-web
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.presi-web == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/presi-web
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: apps/presi/apps/web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-storage-backend:
name: Build storage-backend
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.storage-backend == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/storage-backend
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: apps/storage/apps/backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-storage-web:
name: Build storage-web
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.storage-web == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/storage-web
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: apps/storage/apps/web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-telegram-stats-bot:
name: Build telegram-stats-bot
runs-on: ubuntu-latest