2
0

dockerhub.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. nginxproxy/nginx-proxy
  37. jwilder/nginx-proxy
  38. tags: |
  39. type=semver,pattern={{version}}
  40. type=semver,pattern={{major}}.{{minor}}
  41. type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
  42. type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
  43. labels: |
  44. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  45. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  46. - name: Set up QEMU
  47. uses: docker/setup-qemu-action@v1
  48. - name: Set up Docker Buildx
  49. uses: docker/setup-buildx-action@v1
  50. - name: Login to DockerHub
  51. uses: docker/login-action@v1
  52. with:
  53. username: ${{ secrets.DOCKERHUB_USERNAME }}
  54. password: ${{ secrets.DOCKERHUB_TOKEN }}
  55. - name: Build and push the Debian based image
  56. if: github.ref == 'refs/heads/main'
  57. id: docker_build_debian
  58. uses: docker/build-push-action@v2
  59. with:
  60. context: .
  61. file: Dockerfile
  62. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  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: Images digests
  68. if: github.ref == 'refs/heads/main'
  69. run: echo ${{ steps.docker_build_debian.outputs.digest }}
  70. - name: Build and push the Debian based dev image
  71. if: github.ref == 'refs/heads/dev'
  72. id: docker_build_debian_dev
  73. uses: docker/build-push-action@v2
  74. with:
  75. file: Dockerfile
  76. build-args: DOCKER_GEN_VERSION=main
  77. platforms: linux/amd64,linux/arm64,linux/arm/v7
  78. push: true
  79. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  80. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  81. - name: Images digests
  82. if: github.ref == 'refs/heads/dev'
  83. run: echo ${{ steps.docker_build_debian_dev.outputs.digest }}
  84. multiarch-build-alpine:
  85. runs-on: ubuntu-latest
  86. steps:
  87. - name: Checkout
  88. uses: actions/checkout@v2
  89. with:
  90. fetch-depth: 0
  91. - name: Retrieve version
  92. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  93. - name: Get Docker tags for Alpine based image
  94. id: docker_meta_alpine
  95. uses: docker/metadata-action@v3
  96. with:
  97. images: |
  98. nginxproxy/nginx-proxy
  99. jwilder/nginx-proxy
  100. tags: |
  101. type=semver,suffix=-alpine,pattern={{version}}
  102. type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
  103. type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/main' }}
  104. type=raw,value=dev-alpine,enable=${{ github.ref == 'refs/heads/dev' }}
  105. labels: |
  106. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  107. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  108. flavor: latest=false
  109. - name: Set up QEMU
  110. uses: docker/setup-qemu-action@v1
  111. - name: Set up Docker Buildx
  112. uses: docker/setup-buildx-action@v1
  113. - name: Login to DockerHub
  114. uses: docker/login-action@v1
  115. with:
  116. username: ${{ secrets.DOCKERHUB_USERNAME }}
  117. password: ${{ secrets.DOCKERHUB_TOKEN }}
  118. - name: Build and push the Alpine based image
  119. if: github.ref == 'refs/heads/main'
  120. id: docker_build_alpine
  121. uses: docker/build-push-action@v2
  122. with:
  123. context: .
  124. file: Dockerfile.alpine
  125. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  126. platforms: linux/amd64,linux/arm64,linux/arm/v7
  127. push: true
  128. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  129. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  130. - name: Images digests
  131. if: github.ref == 'refs/heads/main'
  132. run: echo ${{ steps.docker_build_alpine.outputs.digest }}
  133. - name: Build and push the Alpine based dev image
  134. if: github.ref == 'refs/heads/dev'
  135. id: docker_build_alpine_dev
  136. uses: docker/build-push-action@v2
  137. with:
  138. file: Dockerfile.alpine
  139. build-args: DOCKER_GEN_VERSION=main
  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/dev'
  146. run: echo ${{ steps.docker_build_alpine_dev.outputs.digest }}