dockerhub.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: DockerHub
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. tags:
  8. - '*.*.*'
  9. paths-ignore:
  10. - 'test/*'
  11. - '.gitignore'
  12. - '.travis.yml'
  13. - 'docker-compose-separate-containers.yml'
  14. - 'docker-compose.yml'
  15. - 'LICENSE'
  16. - 'Makefile'
  17. - '*.md'
  18. jobs:
  19. multiarch-build:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@v2
  24. with:
  25. fetch-depth: 0
  26. - name: Get Docker tags for Debian based image
  27. id: docker_meta_debian
  28. uses: crazy-max/ghaction-docker-meta@v1
  29. with:
  30. images: nginxproxy/nginx-proxy
  31. tag-semver: |
  32. {{version}}
  33. {{major}}.{{minor}}
  34. - name: Get Docker tags for Alpine based image
  35. id: docker_meta_alpine
  36. uses: crazy-max/ghaction-docker-meta@v1
  37. with:
  38. images: nginxproxy/nginx-proxy
  39. tag-semver: |
  40. {{version}}-alpine
  41. {{major}}.{{minor}}-alpine
  42. - name: Set up QEMU
  43. uses: docker/setup-qemu-action@v1
  44. - name: Set up Docker Buildx
  45. uses: docker/setup-buildx-action@v1
  46. - name: Login to DockerHub
  47. uses: docker/login-action@v1
  48. with:
  49. username: ${{ secrets.DOCKERHUB_USERNAME }}
  50. password: ${{ secrets.DOCKERHUB_TOKEN }}
  51. - name: Build and push the Debian based image
  52. id: docker_build_debian
  53. uses: docker/build-push-action@v2
  54. with:
  55. file: Dockerfile
  56. platforms: linux/amd64
  57. push: true
  58. tags: |
  59. ${{ github.ref != 'refs/heads/master' && steps.docker_meta_debian.outputs.tags || '' }}
  60. ${{ github.ref == 'refs/heads/master' && 'nginxproxy/nginx-proxy:latest' || '' }}
  61. labels: ${{ steps.docker_meta.outputs.labels }}
  62. - name: Build and push the Alpine based image
  63. id: docker_build_alpine
  64. uses: docker/build-push-action@v2
  65. with:
  66. file: Dockerfile.alpine
  67. platforms: linux/amd64
  68. push: true
  69. tags: |
  70. ${{ github.ref != 'refs/heads/master' && steps.docker_meta_alpine.outputs.tags || '' }}
  71. ${{ github.ref == 'refs/heads/master' && 'nginxproxy/nginx-proxy:alpine' || '' }}
  72. labels: ${{ steps.docker_meta.outputs.labels }}
  73. - name: Images digests
  74. run: |
  75. echo ${{ steps.docker_build_debian.outputs.digest }}
  76. echo ${{ steps.docker_build_alpine.outputs.digest }}