dockerhub.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. name: DockerHub
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. tags:
  8. - '*.*.*'
  9. paths-ignore:
  10. - 'test/*'
  11. - '.gitignore'
  12. - '.travis.yml'
  13. - 'docker-compose-separate-containers.yml'
  14. - 'docker-compose.yml'
  15. - 'LICENSE'
  16. - 'Makefile'
  17. - '*.md'
  18. jobs:
  19. multiarch-build:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@v2
  24. with:
  25. fetch-depth: 0
  26. - name: Get Docker tags for Debian based image
  27. id: docker_meta_debian
  28. uses: crazy-max/ghaction-docker-meta@v2
  29. with:
  30. images: |
  31. nginxproxy/nginx-proxy
  32. jwilder/nginx-proxy
  33. tags: |
  34. type=semver,pattern={{version}}
  35. type=semver,pattern={{major}}.{{minor}}
  36. type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  37. - name: Get Docker tags for Alpine based image
  38. id: docker_meta_alpine
  39. uses: crazy-max/ghaction-docker-meta@v2
  40. with:
  41. images: |
  42. nginxproxy/nginx-proxy
  43. jwilder/nginx-proxy
  44. tags: |
  45. type=semver,suffix=-alpine,pattern={{version}}
  46. type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
  47. type=raw,value=alpine,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  48. flavor: latest=false
  49. - name: Set up QEMU
  50. uses: docker/setup-qemu-action@v1
  51. - name: Set up Docker Buildx
  52. uses: docker/setup-buildx-action@v1
  53. - name: Login to DockerHub
  54. uses: docker/login-action@v1
  55. with:
  56. username: ${{ secrets.DOCKERHUB_USERNAME }}
  57. password: ${{ secrets.DOCKERHUB_TOKEN }}
  58. - name: Build and push the Debian based image
  59. id: docker_build_debian
  60. uses: docker/build-push-action@v2
  61. with:
  62. file: Dockerfile
  63. platforms: linux/amd64,linux/arm64,linux/arm/v7
  64. push: true
  65. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  66. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  67. - name: Build and push the Alpine based image
  68. id: docker_build_alpine
  69. uses: docker/build-push-action@v2
  70. with:
  71. file: Dockerfile.alpine
  72. platforms: linux/amd64,linux/arm64,linux/arm/v7
  73. push: true
  74. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  75. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  76. - name: Images digests
  77. run: |
  78. echo ${{ steps.docker_build_debian.outputs.digest }}
  79. echo ${{ steps.docker_build_alpine.outputs.digest }}