docker.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. name: Docker
  2. on:
  3. schedule:
  4. - cron: '0 1 * * *'
  5. push:
  6. tags:
  7. - '[0-9]+.[0-9]+.[0-9]+'
  8. pull_request:
  9. branches: [ main ]
  10. jobs:
  11. test-docker-images:
  12. if: github.event.pull_request
  13. name: Test Images
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout
  17. uses: actions/checkout@v4
  18. - name: Build Alpine image
  19. uses: docker/build-push-action@v5
  20. with:
  21. context: .
  22. file: ./packaging/docker/alpine/Dockerfile
  23. push: false
  24. tags: ${{ github.repository_owner }}/miniflux:alpine-dev
  25. - name: Test Alpine Docker image
  26. run: docker run --rm ${{ github.repository_owner }}/miniflux:alpine-dev miniflux -i
  27. - name: Build Distroless image
  28. uses: docker/build-push-action@v5
  29. with:
  30. context: .
  31. file: ./packaging/docker/distroless/Dockerfile
  32. push: false
  33. tags: ${{ github.repository_owner }}/miniflux:distroless-dev
  34. - name: Test Distroless Docker image
  35. run: docker run --rm ${{ github.repository_owner }}/miniflux:distroless-dev miniflux -i
  36. publish-docker-images:
  37. if: ${{ ! github.event.pull_request }}
  38. name: Publish Images
  39. permissions:
  40. packages: write
  41. runs-on: ubuntu-latest
  42. steps:
  43. - name: Checkout
  44. uses: actions/checkout@v4
  45. with:
  46. fetch-depth: 0
  47. - name: Generate Alpine Docker tag
  48. id: docker_alpine_tag
  49. run: |
  50. DOCKER_IMAGE=${{ github.repository_owner }}/miniflux
  51. DOCKER_VERSION=dev
  52. if [ "${{ github.event_name }}" = "schedule" ]; then
  53. DOCKER_VERSION=nightly
  54. TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION}"
  55. elif [[ $GITHUB_REF == refs/tags/* ]]; then
  56. DOCKER_VERSION=${GITHUB_REF#refs/tags/}
  57. TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION},docker.io/${DOCKER_IMAGE}:latest,ghcr.io/${DOCKER_IMAGE}:latest,quay.io/${DOCKER_IMAGE}:latest"
  58. fi
  59. echo ::set-output name=tags::${TAGS}
  60. - name: Generate Distroless Docker tag
  61. id: docker_distroless_tag
  62. run: |
  63. DOCKER_IMAGE=${{ github.repository_owner }}/miniflux
  64. DOCKER_VERSION=dev-distroless
  65. if [ "${{ github.event_name }}" = "schedule" ]; then
  66. DOCKER_VERSION=nightly-distroless
  67. TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION}"
  68. elif [[ $GITHUB_REF == refs/tags/* ]]; then
  69. DOCKER_VERSION=${GITHUB_REF#refs/tags/}-distroless
  70. TAGS="docker.io/${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},quay.io/${DOCKER_IMAGE}:${DOCKER_VERSION},docker.io/${DOCKER_IMAGE}:latest-distroless,ghcr.io/${DOCKER_IMAGE}:latest-distroless,quay.io/${DOCKER_IMAGE}:latest-distroless"
  71. fi
  72. echo ::set-output name=tags::${TAGS}
  73. - name: Set up QEMU
  74. uses: docker/setup-qemu-action@v3
  75. - name: Set up Docker Buildx
  76. uses: docker/setup-buildx-action@v3
  77. - name: Login to DockerHub
  78. uses: docker/login-action@v3
  79. with:
  80. username: ${{ secrets.DOCKERHUB_USERNAME }}
  81. password: ${{ secrets.DOCKERHUB_TOKEN }}
  82. - name: Login to GitHub Container Registry
  83. uses: docker/login-action@v3
  84. with:
  85. registry: ghcr.io
  86. username: ${{ github.repository_owner }}
  87. password: ${{ secrets.GITHUB_TOKEN }}
  88. - name: Login to Quay Container Registry
  89. uses: docker/login-action@v3
  90. with:
  91. registry: quay.io
  92. username: ${{ secrets.QUAY_USERNAME }}
  93. password: ${{ secrets.QUAY_TOKEN }}
  94. - name: Build and Push Alpine images
  95. uses: docker/build-push-action@v5
  96. with:
  97. context: .
  98. file: ./packaging/docker/alpine/Dockerfile
  99. platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
  100. push: true
  101. tags: ${{ steps.docker_alpine_tag.outputs.tags }}
  102. - name: Build and Push Distroless images
  103. uses: docker/build-push-action@v5
  104. with:
  105. context: .
  106. file: ./packaging/docker/distroless/Dockerfile
  107. platforms: linux/amd64,linux/arm64
  108. push: true
  109. tags: ${{ steps.docker_distroless_tag.outputs.tags }}