call-docker-build-result.yaml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: Build Result
  2. # template source: https://github.com/dockersamples/.github/blob/main/templates/call-docker-build.yaml
  3. on:
  4. # we want pull requests so we can build(test) but not push to image registry
  5. push:
  6. branches:
  7. - 'main'
  8. # only build when important files change
  9. paths:
  10. - 'result/**'
  11. - '.github/workflows/call-docker-build-result.yaml'
  12. pull_request:
  13. branches:
  14. - 'main'
  15. # only build when important files change
  16. paths:
  17. - 'result/**'
  18. - '.github/workflows/call-docker-build-result.yaml'
  19. jobs:
  20. call-docker-build:
  21. name: Result Call Docker Build
  22. uses: dockersamples/.github/.github/workflows/reusable-docker-build.yaml@main
  23. permissions:
  24. contents: read
  25. packages: write # needed to push docker image to ghcr.io
  26. pull-requests: write # needed to create and update comments in PRs
  27. secrets:
  28. # Only needed if with:dockerhub-enable is true below
  29. dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
  30. # Only needed if with:dockerhub-enable is true below
  31. dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
  32. with:
  33. ### REQUIRED
  34. ### ENABLE ONE OR BOTH REGISTRIES
  35. ### tell docker where to push.
  36. ### NOTE if Docker Hub is set to true, you must set secrets above and also add account/repo/tags below
  37. dockerhub-enable: true
  38. ghcr-enable: true
  39. ### REQUIRED
  40. ### A list of the account/repo names for docker build. List should match what's enabled above
  41. ### defaults to:
  42. image-names: |
  43. ghcr.io/dockersamples/example-voting-app-result
  44. dockersamples/examplevotingapp_result
  45. ### REQUIRED set rules for tagging images, based on special action syntax:
  46. ### https://github.com/docker/metadata-action#tags-input
  47. ### defaults to:
  48. tag-rules: |
  49. type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  50. type=raw,value=before,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  51. type=raw,value=after,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
  52. type=ref,event=pr
  53. ### path to where docker should copy files into image
  54. ### defaults to root of repository (.)
  55. context: result
  56. ### Dockerfile alternate name. Default is Dockerfile (relative to context path)
  57. # file: Containerfile
  58. ### build stage to target, defaults to empty, which builds to last stage in Dockerfile
  59. # target:
  60. ### platforms to build for, defaults to linux/amd64
  61. ### other options: linux/amd64,linux/arm64,linux/arm/v7
  62. platforms: linux/amd64,linux/arm64,linux/arm/v7
  63. ### Create a PR comment with image tags and labels
  64. ### defaults to false
  65. # comment-enable: false