call-docker-build-worker.yaml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. name: Build Worker
  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. - 'worker/**'
  11. - '.github/workflows/call-docker-build-worker.yaml'
  12. pull_request:
  13. branches:
  14. - 'main'
  15. # only build when important files change
  16. paths:
  17. - 'worker/**'
  18. - '.github/workflows/call-docker-build-worker.yaml'
  19. jobs:
  20. call-docker-build:
  21. name: Worker 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: false
  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-worker
  44. # dockersamples/examplevotingapp_worker
  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=ref,event=pr
  51. # type=ref,event=branch
  52. # type=semver,pattern={{version}}
  53. # type=raw,value=gha-${{ github.run_id }}
  54. ### path to where docker should copy files into image
  55. ### defaults to root of repository (.)
  56. context: worker
  57. ### Dockerfile alternate name. Default is Dockerfile (relative to context path)
  58. # file: Containerfile
  59. ### build stage to target, defaults to empty, which builds to last stage in Dockerfile
  60. # target:
  61. ### platforms to build for, defaults to linux/amd64
  62. ### other options: linux/amd64,linux/arm64,linux/arm/v7
  63. platforms: linux/amd64,linux/arm64,linux/arm/v7
  64. ### Create a PR comment with image tags and labels
  65. ### defaults to false
  66. # comment-enable: false