dockerhub.yml 3.6 KB

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