publish-workflow.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. name: Publish Docker image
  2. on:
  3. push:
  4. tags:
  5. - '**'
  6. jobs:
  7. openapi:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v4
  11. - name: Set up Python 3.13
  12. uses: actions/setup-python@v4
  13. with:
  14. python-version: "3.13"
  15. cache: 'pip'
  16. - name: Install requirements
  17. run: |
  18. pip install fastapi uvicorn python-multipart
  19. pip install -r requirements-min.txt
  20. - name: Generate openapi.json
  21. run: |
  22. python -m etc.tool.openapi
  23. - uses: actions/upload-artifact@v4
  24. with:
  25. name: openapi
  26. path: openapi.json
  27. publish:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: Checkout repository
  31. uses: actions/checkout@v4
  32. - name: Set up QEMU
  33. uses: docker/setup-qemu-action@v3
  34. - name: Set up Docker Buildx
  35. uses: docker/setup-buildx-action@v3
  36. - name: Get metadata for Docker
  37. id: metadata
  38. uses: docker/metadata-action@v5
  39. with:
  40. images: |
  41. hlohaus789/g4f
  42. - name: Log in to Docker Hub
  43. uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
  44. with:
  45. username: ${{ secrets.DOCKER_USERNAME }}
  46. password: ${{ secrets.DOCKER_PASSWORD }}
  47. - name: Build and push armv7 image
  48. uses: docker/build-push-action@v5
  49. with:
  50. context: .
  51. file: docker/Dockerfile-armv7
  52. platforms: linux/arm/v7
  53. push: true
  54. tags: |
  55. hlohaus789/g4f:latest-armv7
  56. hlohaus789/g4f:${{ github.ref_name }}-armv7
  57. labels: ${{ steps.metadata.outputs.labels }}
  58. build-args: |
  59. G4F_VERSION=${{ github.ref_name }}
  60. - name: Build and push small images
  61. uses: docker/build-push-action@v5
  62. with:
  63. context: .
  64. file: docker/Dockerfile-slim
  65. platforms: linux/amd64,linux/arm64
  66. push: true
  67. tags: |
  68. hlohaus789/g4f:latest-slim
  69. hlohaus789/g4f:${{ github.ref_name }}-slim
  70. labels: ${{ steps.metadata.outputs.labels }}
  71. build-args: |
  72. G4F_VERSION=${{ github.ref_name }}
  73. - name: Build and push arm64 image
  74. uses: docker/build-push-action@v5
  75. with:
  76. context: .
  77. file: docker/Dockerfile-slim
  78. platforms: linux/arm64
  79. push: true
  80. tags: ${{ steps.metadata.outputs.tags }}
  81. labels: ${{ steps.metadata.outputs.labels }}
  82. build-args: |
  83. G4F_VERSION=${{ github.ref_name }}
  84. - name: Build and push big image
  85. uses: docker/build-push-action@v5
  86. with:
  87. context: .
  88. file: docker/Dockerfile
  89. platforms: linux/amd64
  90. push: true
  91. tags: ${{ steps.metadata.outputs.tags }}
  92. labels: ${{ steps.metadata.outputs.labels }}
  93. build-args: |
  94. G4F_VERSION=${{ github.ref_name }}