mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
🚀 ci(nutriphi): add production deployment configuration
- Add backend Dockerfile with multi-stage build and health checks - Add web Dockerfile with SvelteKit static env vars - Add docker-entrypoint.sh for automatic DB migration - Add nutriphi-backend and nutriphi-web to docker-compose.macmini.yml - Add CI/CD detection and build jobs for nutriphi - Update CORS origins in mana-core-auth to include nutriphi.mana.how - Include nutriphi in deploy:landing:all script Ports: Backend 3023, Web 5189 Domain: nutriphi.mana.how / nutriphi-api.mana.how
This commit is contained in:
parent
43991383a1
commit
c031540ef1
6 changed files with 312 additions and 2 deletions
82
.github/workflows/ci.yml
vendored
82
.github/workflows/ci.yml
vendored
|
|
@ -66,6 +66,8 @@ jobs:
|
|||
storage-backend: ${{ steps.changes.outputs.storage-backend }}
|
||||
storage-web: ${{ steps.changes.outputs.storage-web }}
|
||||
telegram-stats-bot: ${{ steps.changes.outputs.telegram-stats-bot }}
|
||||
nutriphi-backend: ${{ steps.changes.outputs.nutriphi-backend }}
|
||||
nutriphi-web: ${{ steps.changes.outputs.nutriphi-web }}
|
||||
any-changes: ${{ steps.changes.outputs.any-changes }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
@ -96,6 +98,8 @@ jobs:
|
|||
echo "storage-backend=true" >> $GITHUB_OUTPUT
|
||||
echo "storage-web=true" >> $GITHUB_OUTPUT
|
||||
echo "telegram-stats-bot=true" >> $GITHUB_OUTPUT
|
||||
echo "nutriphi-backend=true" >> $GITHUB_OUTPUT
|
||||
echo "nutriphi-web=true" >> $GITHUB_OUTPUT
|
||||
echo "any-changes=true" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -130,6 +134,8 @@ jobs:
|
|||
echo "storage-backend=true" >> $GITHUB_OUTPUT
|
||||
echo "storage-web=true" >> $GITHUB_OUTPUT
|
||||
echo "telegram-stats-bot=true" >> $GITHUB_OUTPUT
|
||||
echo "nutriphi-backend=true" >> $GITHUB_OUTPUT
|
||||
echo "nutriphi-web=true" >> $GITHUB_OUTPUT
|
||||
echo "any-changes=true" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -297,6 +303,22 @@ jobs:
|
|||
echo "telegram-stats-bot=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# nutriphi-backend
|
||||
NUTRIPHI_BACKEND_CHANGED=$(check_pattern "apps/nutriphi/apps/backend/|apps/nutriphi/packages/")
|
||||
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$NUTRIPHI_BACKEND_CHANGED" == "true" ]; then
|
||||
echo "nutriphi-backend=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "nutriphi-backend=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# nutriphi-web
|
||||
NUTRIPHI_WEB_CHANGED=$(check_pattern "apps/nutriphi/apps/web/|apps/nutriphi/packages/")
|
||||
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_AUTH_CHANGED" == "true" ] || [ "$SHARED_UI_CHANGED" == "true" ] || [ "$SHARED_WEB_CHANGED" == "true" ] || [ "$NUTRIPHI_WEB_CHANGED" == "true" ]; then
|
||||
echo "nutriphi-web=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "nutriphi-web=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Check if any service needs building
|
||||
if grep -q "=true" $GITHUB_OUTPUT; then
|
||||
echo "any-changes=true" >> $GITHUB_OUTPUT
|
||||
|
|
@ -327,6 +349,8 @@ jobs:
|
|||
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
|
||||
echo "| nutriphi-backend | ${{ steps.changes.outputs.nutriphi-backend }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| nutriphi-web | ${{ steps.changes.outputs.nutriphi-web }} |" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# ===========================================
|
||||
# Validation job - runs on PRs
|
||||
|
|
@ -858,3 +882,61 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-nutriphi-backend:
|
||||
name: Build nutriphi-backend
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.nutriphi-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 }}/nutriphi-backend
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: apps/nutriphi/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-nutriphi-web:
|
||||
name: Build nutriphi-web
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.nutriphi-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 }}/nutriphi-web
|
||||
tags: type=raw,value=latest
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: apps/nutriphi/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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue