docker_build.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Docker Image CI
  2. on:
  3. workflow_dispatch:
  4. release:
  5. types: [released]
  6. env:
  7. REGISTRY: ghcr.io
  8. jobs:
  9. build-and-push-image:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Get version
  16. id: get_version
  17. run: |
  18. echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
  19. echo "${GITHUB_REF/refs\/tags\//}"
  20. echo "${GITHUB_REF#refs/*/}"
  21. echo "${GITHUB_REF}"
  22. - uses: actions/checkout@v3
  23. - name: set lower case repository name
  24. run: |
  25. echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
  26. env:
  27. REPOSITORY: '${{ github.repository }}'
  28. - name: Set up QEMU
  29. uses: docker/setup-qemu-action@v3
  30. - name: Set up Docker Buildx
  31. uses: docker/setup-buildx-action@v3
  32. - uses: actions/setup-node@v4
  33. - name: Build FE
  34. run: |
  35. echo "$(git show -s --format=%H)"
  36. echo "GITHASH=$(git show -s --format=%H)" >> ${GITHUB_ENV}
  37. make build_fe
  38. - name: Log in to the Container registry
  39. uses: docker/login-action@v2.1.0
  40. with:
  41. registry: ${{ env.REGISTRY }}
  42. username: ${{ github.actor }}
  43. password: ${{ secrets.GITHUB_TOKEN }}
  44. - name: Build and push Docker images
  45. uses: docker/build-push-action@v4
  46. with:
  47. build-args: |
  48. VERSION=${{ env.VERSION }}
  49. GITHASH=${{ env.GITHASH }}
  50. context: .
  51. file: ./DockerfileGithubAction
  52. platforms: |
  53. linux/386
  54. linux/amd64
  55. linux/arm/v7
  56. linux/arm64
  57. push: true
  58. tags: |
  59. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}
  60. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:latest