docker-publish.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Build and publish Docker image
  2. on:
  3. release:
  4. types: [published]
  5. schedule:
  6. - cron: '0 0 * * *'
  7. workflow_dispatch:
  8. env:
  9. REGISTRY: ghcr.io
  10. IMAGE_NAME: ${{ github.repository }}
  11. jobs:
  12. build-and-push-image:
  13. runs-on: ubuntu-latest
  14. permissions:
  15. contents: read
  16. packages: write
  17. steps:
  18. - name: Checkout repository
  19. uses: actions/checkout@v4
  20. - name: Log in to the Container registry
  21. uses: docker/login-action@v3
  22. with:
  23. registry: ${{ env.REGISTRY }}
  24. username: ${{ github.actor }}
  25. password: ${{ secrets.GITHUB_TOKEN }}
  26. - name: Extract metadata for Docker build
  27. id: meta
  28. uses: docker/metadata-action@v5
  29. with:
  30. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  31. flavor: latest=true
  32. tags: |
  33. type=semver,pattern={{version}}
  34. type=schedule,prefix=nightly-,pattern={{date 'YYYYMMDD'}}
  35. type=raw,enable=${{ github.event_name == 'workflow_dispatch' }},value=workflow_dispatch-{{branch}}-{{sha}}
  36. - name: Set up QEMU
  37. uses: docker/setup-qemu-action@v3
  38. with:
  39. platforms: arm64
  40. - name: Set up Docker Buildx
  41. uses: docker/setup-buildx-action@v3
  42. - name: Build and push Docker image
  43. uses: docker/build-push-action@v6
  44. with:
  45. context: .
  46. build-args: DEPENDENCIES=bcrypt,argon2,ldap
  47. push: true
  48. tags: ${{ steps.meta.outputs.tags }}
  49. labels: ${{ steps.meta.outputs.labels }}
  50. platforms: linux/amd64,linux/arm64