docker.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. name: Docker
  2. permissions:
  3. contents: read
  4. on:
  5. schedule:
  6. - cron: '0 1 * * *'
  7. push:
  8. tags:
  9. - '[0-9]+.[0-9]+.[0-9]+'
  10. pull_request:
  11. branches: [ main ]
  12. paths:
  13. - 'packaging/docker/**'
  14. - '.github/workflows/docker.yml'
  15. jobs:
  16. docker-images:
  17. name: Docker Images
  18. if: github.repository_owner == 'miniflux'
  19. permissions:
  20. packages: write
  21. runs-on: ubuntu-latest
  22. environment: ${{ github.event_name != 'pull_request' && 'release' || '' }}
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  26. with:
  27. persist-credentials: false
  28. fetch-depth: 0
  29. - name: Generate Alpine Docker tags
  30. id: docker_alpine_tags
  31. uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
  32. with:
  33. images: |
  34. docker.io/${{ github.repository_owner }}/miniflux
  35. ghcr.io/${{ github.repository_owner }}/miniflux
  36. quay.io/${{ github.repository_owner }}/miniflux
  37. tags: |
  38. type=ref,event=pr
  39. type=schedule,pattern=nightly
  40. type=semver,pattern={{raw}}
  41. - name: Generate Distroless Docker tags
  42. id: docker_distroless_tags
  43. uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
  44. with:
  45. images: |
  46. docker.io/${{ github.repository_owner }}/miniflux
  47. ghcr.io/${{ github.repository_owner }}/miniflux
  48. quay.io/${{ github.repository_owner }}/miniflux
  49. tags: |
  50. type=ref,event=pr
  51. type=schedule,pattern=nightly
  52. type=semver,pattern={{raw}}
  53. flavor: |
  54. suffix=-distroless,onlatest=true
  55. - name: Set up QEMU
  56. uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
  57. - name: Set up Docker Buildx
  58. uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
  59. - name: Login to DockerHub
  60. if: ${{ github.event_name != 'pull_request' }}
  61. uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
  62. with:
  63. username: ${{ secrets.DOCKERHUB_USERNAME }}
  64. password: ${{ secrets.DOCKERHUB_TOKEN }}
  65. - name: Login to GitHub Container Registry
  66. if: ${{ github.event_name != 'pull_request' }}
  67. uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
  68. with:
  69. registry: ghcr.io
  70. username: ${{ github.repository_owner }}
  71. password: ${{ secrets.GITHUB_TOKEN }}
  72. - name: Login to Quay Container Registry
  73. if: ${{ github.event_name != 'pull_request' }}
  74. uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
  75. with:
  76. registry: quay.io
  77. username: ${{ secrets.QUAY_USERNAME }}
  78. password: ${{ secrets.QUAY_TOKEN }}
  79. - name: Build and Push Alpine images
  80. uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
  81. with:
  82. context: .
  83. file: ./packaging/docker/alpine/Dockerfile
  84. platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/riscv64
  85. push: ${{ github.event_name != 'pull_request' }}
  86. provenance: mode=max
  87. sbom: true
  88. tags: ${{ steps.docker_alpine_tags.outputs.tags }}
  89. - name: Build and Push Distroless images
  90. uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
  91. with:
  92. context: .
  93. file: ./packaging/docker/distroless/Dockerfile
  94. platforms: linux/amd64,linux/arm64,linux/riscv64
  95. push: ${{ github.event_name != 'pull_request' }}
  96. provenance: mode=max
  97. sbom: true
  98. tags: ${{ steps.docker_distroless_tags.outputs.tags }}