ci(deps): bump docker/setup-buildx-action from 3 to 4 #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: Docker Build & Push | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx (with retry) | |
| uses: docker/setup-buildx-action@v4 | |
| with: | |
| install: true | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| - name: Verify Docker setup | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Verifying Docker setup..." | |
| echo "Docker version:" | |
| docker version | |
| echo "Available builders:" | |
| docker buildx ls || echo "Buildx not available, using standard Docker" | |
| echo -e "\033[32m[PASS]\033[0m Docker setup verified" | |
| - name: Build Docker image | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Building Docker image..." | |
| if docker buildx version >/dev/null 2>&1; then | |
| echo "Using Docker Buildx" | |
| docker buildx build \ | |
| --load \ | |
| --tag path-app:test \ | |
| --cache-from type=gha \ | |
| --cache-to type=gha,mode=max \ | |
| . || { | |
| echo "Buildx failed, falling back to standard build" | |
| docker build -t path-app:test . | |
| } | |
| else | |
| echo "Using standard Docker build" | |
| docker build -t path-app:test . | |
| fi | |
| docker images path-app:test | |
| echo -e "\033[32m[PASS]\033[0m Docker image built successfully" | |
| - name: Create test environment | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Creating test environment..." | |
| docker run -d --name path-test \ | |
| -p 8000:8000 \ | |
| -e GEMINI_API_KEY=test-key \ | |
| -e FLASK_DEBUG=1 \ | |
| path-app:test | |
| docker ps | |
| echo -e "\033[32m[PASS]\033[0m Test environment created" | |
| - name: Wait for app to start | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Waiting for app to start..." | |
| sleep 10 | |
| docker logs path-test | |
| timeout 60 bash -c 'until curl -f http://localhost:8000/ > /dev/null 2>&1; do | |
| echo "Waiting..."; sleep 3; | |
| done' || { | |
| echo -e "\033[31m[ERROR]\033[0m App failed to start, checking logs:" | |
| docker logs path-test | |
| exit 1 | |
| } | |
| echo -e "\033[32m[PASS]\033[0m App started successfully" | |
| - name: Run health check | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Testing app endpoints..." | |
| echo "Root endpoint:" | |
| curl -s http://localhost:8000/ | head -20 | |
| echo -e "\n\nVerify endpoint:" | |
| if curl -s http://localhost:8000/verify | grep -q "verification"; then | |
| echo -e "\033[32m[PASS]\033[0m App is responding correctly" | |
| else | |
| echo -e "\033[31m[ERROR]\033[0m App not responding as expected" | |
| echo "Response content:" | |
| curl -s http://localhost:8000/verify | head -20 | |
| docker logs path-test | |
| exit 1 | |
| fi | |
| - name: Clean up | |
| run: | | |
| echo -e "\033[36m[INFO]\033[0m Cleaning up test environment..." | |
| docker stop path-test || true | |
| docker rm path-test || true | |
| echo -e "\033[32m[PASS]\033[0m Cleanup completed" |