fix: CORS config, SQLAlchemy models, pipeline context manager, and te… #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| name: Build & push images | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set lowercase image prefix | |
| run: echo "IMAGE_PREFIX=ghcr.io/$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')/archmind-ai" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build & push backend | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| push: true | |
| tags: ${{ env.IMAGE_PREFIX }}/backend:${{ github.sha }},${{ env.IMAGE_PREFIX }}/backend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build & push frontend | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: frontend.Dockerfile | |
| push: true | |
| tags: ${{ env.IMAGE_PREFIX }}/frontend:${{ github.sha }},${{ env.IMAGE_PREFIX }}/frontend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| smoke-test: | |
| name: Smoke test (Render) | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Health check | |
| run: | | |
| for i in 1 2 3 4 5; do | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://archmind-ai.onrender.com/api/health) | |
| if [ "$STATUS" = "200" ]; then | |
| echo "Health check passed (HTTP $STATUS)" | |
| exit 0 | |
| fi | |
| echo "Attempt $i: HTTP $STATUS — retrying in 15s" | |
| sleep 15 | |
| done | |
| echo "Health check failed after 5 attempts" | |
| exit 1 |