Update all changes #1
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: Docker Build | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| docker-build: | |
| name: "\U0001f433 Docker Build" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix= | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Test container starts | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| docker build -t evera-test . | |
| docker run --rm -d --name evera-health-test -p 8000:8000 \ | |
| -e VERA_SERVER_HOST=0.0.0.0 \ | |
| -e VERA_SERVER_PORT=8000 \ | |
| evera-test server & | |
| sleep 10 | |
| curl -sf http://localhost:8000/health && echo "Health check passed!" || echo "Health check failed (expected without LLM)" | |
| docker stop evera-health-test 2>/dev/null || true | |
| - name: Docker image size | |
| if: always() | |
| run: | | |
| SIZE=$(docker images --format "{{.Size}}" evera-test 2>/dev/null || echo "N/A") | |
| echo "## \U0001f433 Docker Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Metric | Value |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---|---|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Image size | $SIZE |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Base image | python:3.12-slim |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Build stages | 2 (builder + runtime) |" >> $GITHUB_STEP_SUMMARY |