dockerhub.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. name: DockerHub
  2. on:
  3. workflow_dispatch:
  4. schedule:
  5. - cron: '0 0 * * 1'
  6. push:
  7. branches:
  8. - main
  9. - dev
  10. tags:
  11. - '*.*.*'
  12. paths-ignore:
  13. - 'test/*'
  14. - '.gitignore'
  15. - '.travis.yml'
  16. - 'docker-compose-separate-containers.yml'
  17. - 'docker-compose.yml'
  18. - 'LICENSE'
  19. - 'Makefile'
  20. - '*.md'
  21. jobs:
  22. multiarch-build-debian:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Checkout
  26. uses: actions/checkout@v2
  27. with:
  28. fetch-depth: 0
  29. - name: Retrieve version
  30. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  31. - name: Get Docker tags for Debian based image
  32. id: docker_meta_debian
  33. uses: docker/metadata-action@v3
  34. with:
  35. images: |
  36. ghcr.io/nginx-proxy/nginx-proxy
  37. nginxproxy/nginx-proxy
  38. jwilder/nginx-proxy
  39. tags: |
  40. type=semver,pattern={{version}}
  41. type=semver,pattern={{major}}.{{minor}}
  42. type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
  43. type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
  44. labels: |
  45. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  46. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  47. - name: Set up QEMU
  48. uses: docker/setup-qemu-action@v1
  49. - name: Set up Docker Buildx
  50. uses: docker/setup-buildx-action@v1
  51. - name: Login to DockerHub
  52. uses: docker/login-action@v1
  53. with:
  54. username: ${{ secrets.DOCKERHUB_USERNAME }}
  55. password: ${{ secrets.DOCKERHUB_TOKEN }}
  56. - name: Log in to GitHub Container Registry
  57. uses: docker/login-action@v1
  58. with:
  59. registry: ghcr.io
  60. username: ${{ github.actor }}
  61. password: ${{ secrets.GITHUB_TOKEN }}
  62. - name: Build and push the Debian based image
  63. if: github.ref == 'refs/heads/main'
  64. id: docker_build_debian
  65. uses: docker/build-push-action@v2
  66. with:
  67. context: .
  68. file: Dockerfile
  69. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  70. platforms: linux/amd64,linux/arm64,linux/arm/v7
  71. push: true
  72. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  73. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  74. - name: Images digests
  75. if: github.ref == 'refs/heads/main'
  76. run: echo ${{ steps.docker_build_debian.outputs.digest }}
  77. - name: Build and push the Debian based dev image
  78. if: github.ref == 'refs/heads/dev'
  79. id: docker_build_debian_dev
  80. uses: docker/build-push-action@v2
  81. with:
  82. file: Dockerfile
  83. build-args: DOCKER_GEN_VERSION=main
  84. platforms: linux/amd64,linux/arm64,linux/arm/v7
  85. push: true
  86. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  87. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  88. - name: Images digests
  89. if: github.ref == 'refs/heads/dev'
  90. run: echo ${{ steps.docker_build_debian_dev.outputs.digest }}
  91. multiarch-build-alpine:
  92. runs-on: ubuntu-latest
  93. steps:
  94. - name: Checkout
  95. uses: actions/checkout@v2
  96. with:
  97. fetch-depth: 0
  98. - name: Retrieve version
  99. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  100. - name: Get Docker tags for Alpine based image
  101. id: docker_meta_alpine
  102. uses: docker/metadata-action@v3
  103. with:
  104. images: |
  105. ghcr.io/nginx-proxy/nginx-proxy
  106. nginxproxy/nginx-proxy
  107. jwilder/nginx-proxy
  108. tags: |
  109. type=semver,suffix=-alpine,pattern={{version}}
  110. type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
  111. type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/main' }}
  112. type=raw,value=dev-alpine,enable=${{ github.ref == 'refs/heads/dev' }}
  113. labels: |
  114. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  115. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  116. flavor: latest=false
  117. - name: Set up QEMU
  118. uses: docker/setup-qemu-action@v1
  119. - name: Set up Docker Buildx
  120. uses: docker/setup-buildx-action@v1
  121. - name: Login to DockerHub
  122. uses: docker/login-action@v1
  123. with:
  124. username: ${{ secrets.DOCKERHUB_USERNAME }}
  125. password: ${{ secrets.DOCKERHUB_TOKEN }}
  126. - name: Log in to GitHub Container Registry
  127. uses: docker/login-action@v1
  128. with:
  129. registry: ghcr.io
  130. username: ${{ github.actor }}
  131. password: ${{ secrets.GITHUB_TOKEN }}
  132. - name: Build and push the Alpine based image
  133. if: github.ref == 'refs/heads/main'
  134. id: docker_build_alpine
  135. uses: docker/build-push-action@v2
  136. with:
  137. context: .
  138. file: Dockerfile.alpine
  139. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  140. platforms: linux/amd64,linux/arm64,linux/arm/v7
  141. push: true
  142. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  143. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  144. - name: Images digests
  145. if: github.ref == 'refs/heads/main'
  146. run: echo ${{ steps.docker_build_alpine.outputs.digest }}
  147. - name: Build and push the Alpine based dev image
  148. if: github.ref == 'refs/heads/dev'
  149. id: docker_build_alpine_dev
  150. uses: docker/build-push-action@v2
  151. with:
  152. file: Dockerfile.alpine
  153. build-args: DOCKER_GEN_VERSION=main
  154. platforms: linux/amd64,linux/arm64,linux/arm/v7
  155. push: true
  156. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  157. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  158. - name: Images digests
  159. if: github.ref == 'refs/heads/dev'
  160. run: echo ${{ steps.docker_build_alpine_dev.outputs.digest }}