docker-image-playground-ui.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Playground UI Docker Image CI
  2. on:
  3. push:
  4. paths:
  5. - 'playground-ui/**'
  6. branches:
  7. - 'main'
  8. release:
  9. types: [ published ]
  10. env:
  11. IMAGE_NAME: 'samepaage/open-assistant-playground-ui'
  12. jobs:
  13. build-and-push:
  14. runs-on: ubuntu-latest
  15. permissions:
  16. packages: write
  17. contents: read
  18. steps:
  19. - uses: actions/checkout@v4
  20. - name: Set up QEMU
  21. uses: docker/setup-qemu-action@v3
  22. - name: Set up Docker Buildx
  23. uses: docker/setup-buildx-action@v3
  24. - name: Login to DockerHub
  25. uses: docker/login-action@v2
  26. with:
  27. username: ${{ secrets.DOCKERHUB_USER }}
  28. password: ${{ secrets.DOCKERHUB_TOKEN }}
  29. - name: Extract metadata (tags, labels) for Docker
  30. id: meta
  31. uses: docker/metadata-action@v5
  32. with:
  33. images: ${{ env.IMAGE_NAME }}
  34. tags: |
  35. type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
  36. type=ref,event=branch
  37. type=sha,enable=true,priority=100,prefix=,suffix=,format=long
  38. type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
  39. - name: Build and push
  40. uses: docker/build-push-action@v5
  41. with:
  42. context: ./playground-ui
  43. platforms: |
  44. linux/amd64
  45. linux/arm64
  46. build-args: |
  47. COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
  48. push: true
  49. tags: ${{ steps.meta.outputs.tags }}
  50. labels: ${{ steps.meta.outputs.labels }}
  51. cache-from: type=gha
  52. cache-to: type=gha,mode=max