release-push-docker.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: "Push containers to Docker Hub on release"
  2. on:
  3. push:
  4. tags:
  5. - '*.*.*'
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v3
  12. - name: Setup environment
  13. run: cp .env.example .env
  14. - name: Setup QEMU
  15. uses: docker/setup-qemu-action@v3
  16. - name: Setup Docker Buildx
  17. uses: docker/setup-buildx-action@v3
  18. - name: Log in to Docker Hub
  19. uses: docker/login-action@v2
  20. with:
  21. username: ${{ secrets.DOCKER_USERNAME }}
  22. password: ${{ secrets.DOCKER_PASSWORD }}
  23. - name: Build and push the backend container
  24. uses: docker/build-push-action@v4
  25. with:
  26. context: .
  27. file: ./prod.Dockerfile
  28. target: backend
  29. push: true
  30. platforms: |
  31. linux/amd64
  32. linux/arm64
  33. tags: |
  34. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_BACKEND_CONTAINER_NAME }}:latest
  35. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_BACKEND_CONTAINER_NAME }}:${{ github.ref_name }}
  36. - name: Build and push the frontend container
  37. uses: docker/build-push-action@v4
  38. with:
  39. context: .
  40. file: ./prod.Dockerfile
  41. target: app
  42. push: true
  43. platforms: |
  44. linux/amd64
  45. linux/arm64
  46. tags: |
  47. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_FRONTEND_CONTAINER_NAME }}:latest
  48. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_FRONTEND_CONTAINER_NAME }}:${{ github.ref_name }}
  49. - name: Build and push the admin dashboard container
  50. uses: docker/build-push-action@v4
  51. with:
  52. context: .
  53. file: ./prod.Dockerfile
  54. target: sh_admin
  55. push: true
  56. platforms: |
  57. linux/amd64
  58. linux/arm64
  59. tags: |
  60. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_SH_ADMIN_CONTAINER_NAME }}:latest
  61. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_SH_ADMIN_CONTAINER_NAME }}:${{ github.ref_name }}
  62. - name: Build and push the AIO container
  63. uses: docker/build-push-action@v4
  64. with:
  65. context: .
  66. file: ./prod.Dockerfile
  67. target: aio
  68. push: true
  69. platforms: |
  70. linux/amd64
  71. linux/arm64
  72. tags: |
  73. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_AIO_CONTAINER_NAME }}:latest
  74. ${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_AIO_CONTAINER_NAME }}:${{ github.ref_name }}