dockerhub.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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: Retrieve version
  29. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  30. - name: Get Docker tags for Debian based image
  31. id: docker_meta_debian
  32. uses: docker/metadata-action@v3
  33. with:
  34. images: |
  35. nginxproxy/nginx-proxy
  36. jwilder/nginx-proxy
  37. tags: |
  38. type=semver,pattern={{version}}
  39. type=semver,pattern={{major}}.{{minor}}
  40. type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  41. labels: |
  42. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  43. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  44. - name: Set up QEMU
  45. uses: docker/setup-qemu-action@v1
  46. - name: Set up Docker Buildx
  47. uses: docker/setup-buildx-action@v1
  48. - name: Login to DockerHub
  49. uses: docker/login-action@v1
  50. with:
  51. username: ${{ secrets.DOCKERHUB_USERNAME }}
  52. password: ${{ secrets.DOCKERHUB_TOKEN }}
  53. - name: Build and push the Debian based image
  54. id: docker_build_debian
  55. uses: docker/build-push-action@v2
  56. with:
  57. context: .
  58. file: Dockerfile
  59. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  60. platforms: linux/amd64,linux/arm64,linux/arm/v7
  61. push: true
  62. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  63. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  64. - name: Images digests
  65. run: echo ${{ steps.docker_build_debian.outputs.digest }}
  66. multiarch-build-alpine:
  67. runs-on: ubuntu-latest
  68. steps:
  69. - name: Checkout
  70. uses: actions/checkout@v2
  71. with:
  72. fetch-depth: 0
  73. - name: Retrieve version
  74. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  75. - name: Get Docker tags for Alpine based image
  76. id: docker_meta_alpine
  77. uses: docker/metadata-action@v3
  78. with:
  79. images: |
  80. nginxproxy/nginx-proxy
  81. jwilder/nginx-proxy
  82. tags: |
  83. type=semver,suffix=-alpine,pattern={{version}}
  84. type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
  85. type=raw,value=alpine,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  86. labels: |
  87. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  88. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  89. flavor: latest=false
  90. - name: Set up QEMU
  91. uses: docker/setup-qemu-action@v1
  92. - name: Set up Docker Buildx
  93. uses: docker/setup-buildx-action@v1
  94. - name: Login to DockerHub
  95. uses: docker/login-action@v1
  96. with:
  97. username: ${{ secrets.DOCKERHUB_USERNAME }}
  98. password: ${{ secrets.DOCKERHUB_TOKEN }}
  99. - name: Build and push the Alpine based image
  100. id: docker_build_alpine
  101. uses: docker/build-push-action@v2
  102. with:
  103. context: .
  104. file: Dockerfile.alpine
  105. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  106. platforms: linux/amd64,linux/arm64,linux/arm/v7
  107. push: true
  108. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  109. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  110. - name: Images digests
  111. run: echo ${{ steps.docker_build_alpine.outputs.digest }}