docker.yml 4.4 KB

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