docker.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Build and Push Multi-Arch Docker Images
  2. on:
  3. push:
  4. tags: ["v*"]
  5. workflow_dispatch:
  6. env:
  7. REGISTRY: docker.io
  8. IMAGE_NAME: wantcat/trendradar
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v4
  15. - name: Set up QEMU
  16. uses: docker/setup-qemu-action@v3
  17. - name: Set up Docker Buildx
  18. uses: docker/setup-buildx-action@v3
  19. with:
  20. driver-opts: |
  21. network=host
  22. - name: Login to Docker Hub
  23. uses: docker/login-action@v3
  24. with:
  25. username: ${{ secrets.DOCKERHUB_USERNAME }}
  26. password: ${{ secrets.DOCKERHUB_TOKEN }}
  27. - name: Extract metadata
  28. id: meta
  29. uses: docker/metadata-action@v5
  30. with:
  31. images: ${{ env.IMAGE_NAME }}
  32. tags: |
  33. type=ref,event=branch
  34. type=semver,pattern={{version}}
  35. type=semver,pattern={{major}}.{{minor}}
  36. type=raw,value=latest,enable={{is_default_branch}}
  37. - name: Build and push
  38. uses: docker/build-push-action@v5
  39. env:
  40. BUILDKIT_PROGRESS: plain
  41. with:
  42. context: .
  43. file: ./docker/Dockerfile
  44. platforms: linux/amd64,linux/arm64
  45. push: true
  46. tags: ${{ steps.meta.outputs.tags }}
  47. labels: ${{ steps.meta.outputs.labels }}
  48. cache-from: type=gha
  49. cache-to: type=gha,mode=max
  50. build-args: |
  51. BUILDKIT_INLINE_CACHE=1