dockerhub.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. - 'docker-compose-separate-containers.yml'
  15. - 'docker-compose.yml'
  16. - 'LICENSE'
  17. - 'Makefile'
  18. - '*.md'
  19. jobs:
  20. multiarch-build-debian:
  21. runs-on: ubuntu-latest
  22. steps:
  23. - name: Checkout
  24. uses: actions/checkout@v2
  25. with:
  26. fetch-depth: 0
  27. - name: Retrieve version
  28. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  29. - name: Get Docker tags for Debian based image
  30. id: docker_meta_debian
  31. uses: docker/metadata-action@v3
  32. with:
  33. images: |
  34. ghcr.io/nginx-proxy/nginx-proxy
  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=${{ github.ref == 'refs/heads/main' }}
  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: Log in to GitHub Container Registry
  54. uses: docker/login-action@v1
  55. with:
  56. registry: ghcr.io
  57. username: ${{ github.actor }}
  58. password: ${{ secrets.GITHUB_TOKEN }}
  59. - name: Build and push the Debian based image
  60. id: docker_build_debian
  61. uses: docker/build-push-action@v2
  62. with:
  63. context: .
  64. file: Dockerfile
  65. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  66. platforms: linux/amd64,linux/arm64,linux/arm/v7
  67. push: true
  68. tags: ${{ steps.docker_meta_debian.outputs.tags }}
  69. labels: ${{ steps.docker_meta_debian.outputs.labels }}
  70. - name: Images digests
  71. run: echo ${{ steps.docker_build_debian.outputs.digest }}
  72. multiarch-build-alpine:
  73. runs-on: ubuntu-latest
  74. steps:
  75. - name: Checkout
  76. uses: actions/checkout@v2
  77. with:
  78. fetch-depth: 0
  79. - name: Retrieve version
  80. run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
  81. - name: Get Docker tags for Alpine based image
  82. id: docker_meta_alpine
  83. uses: docker/metadata-action@v3
  84. with:
  85. images: |
  86. ghcr.io/nginx-proxy/nginx-proxy
  87. nginxproxy/nginx-proxy
  88. jwilder/nginx-proxy
  89. tags: |
  90. type=semver,suffix=-alpine,pattern={{version}}
  91. type=semver,suffix=-alpine,pattern={{major}}.{{minor}}
  92. type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/main' }}
  93. labels: |
  94. org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
  95. org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
  96. flavor: latest=false
  97. - name: Set up QEMU
  98. uses: docker/setup-qemu-action@v1
  99. - name: Set up Docker Buildx
  100. uses: docker/setup-buildx-action@v1
  101. - name: Login to DockerHub
  102. uses: docker/login-action@v1
  103. with:
  104. username: ${{ secrets.DOCKERHUB_USERNAME }}
  105. password: ${{ secrets.DOCKERHUB_TOKEN }}
  106. - name: Log in to GitHub Container Registry
  107. uses: docker/login-action@v1
  108. with:
  109. registry: ghcr.io
  110. username: ${{ github.actor }}
  111. password: ${{ secrets.GITHUB_TOKEN }}
  112. - name: Build and push the Alpine based image
  113. id: docker_build_alpine
  114. uses: docker/build-push-action@v2
  115. with:
  116. context: .
  117. file: Dockerfile.alpine
  118. build-args: NGINX_PROXY_VERSION=${{ env.GIT_DESCRIBE }}
  119. platforms: linux/amd64,linux/arm64,linux/arm/v7
  120. push: true
  121. tags: ${{ steps.docker_meta_alpine.outputs.tags }}
  122. labels: ${{ steps.docker_meta_alpine.outputs.labels }}
  123. - name: Images digests
  124. run: echo ${{ steps.docker_build_alpine.outputs.digest }}