docker-build.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Build docker image
  2. on:
  3. pull_request:
  4. branches:
  5. - "main"
  6. paths:
  7. - api/Dockerfile
  8. - web/Dockerfile
  9. concurrency:
  10. group: docker-build-${{ github.head_ref || github.run_id }}
  11. cancel-in-progress: true
  12. jobs:
  13. build-docker:
  14. runs-on: ubuntu-latest
  15. strategy:
  16. matrix:
  17. include:
  18. - service_name: "api-amd64"
  19. platform: linux/amd64
  20. context: "api"
  21. - service_name: "api-arm64"
  22. platform: linux/arm64
  23. context: "api"
  24. - service_name: "web-amd64"
  25. platform: linux/amd64
  26. context: "web"
  27. - service_name: "web-arm64"
  28. platform: linux/arm64
  29. context: "web"
  30. steps:
  31. - name: Set up QEMU
  32. uses: docker/setup-qemu-action@v3
  33. - name: Set up Docker Buildx
  34. uses: docker/setup-buildx-action@v3
  35. - name: Build Docker Image
  36. uses: docker/build-push-action@v6
  37. with:
  38. push: false
  39. context: "{{defaultContext}}:${{ matrix.context }}"
  40. platforms: ${{ matrix.platform }}
  41. cache-from: type=gha
  42. cache-to: type=gha,mode=max