|
@@ -0,0 +1,83 @@
|
|
|
|
+name: Build Worker
|
|
|
|
+# template source: https://github.com/dockersamples/.github/blob/main/templates/call-docker-build.yaml
|
|
|
|
+
|
|
|
|
+on:
|
|
|
|
+ # we want pull requests so we can build(test) but not push to image registry
|
|
|
|
+ push:
|
|
|
|
+ branches:
|
|
|
|
+ - 'main'
|
|
|
|
+ # only build when important files change
|
|
|
|
+ paths:
|
|
|
|
+ - 'worker/**'
|
|
|
|
+ - '.github/workflows/call-docker-build-worker.yaml'
|
|
|
|
+ pull_request:
|
|
|
|
+ branches:
|
|
|
|
+ - 'main'
|
|
|
|
+ # only build when important files change
|
|
|
|
+ paths:
|
|
|
|
+ - 'worker/**'
|
|
|
|
+ - '.github/workflows/call-docker-build-worker.yaml'
|
|
|
|
+
|
|
|
|
+jobs:
|
|
|
|
+ call-docker-build:
|
|
|
|
+
|
|
|
|
+ name: Call Docker Build
|
|
|
|
+
|
|
|
|
+ uses: dockersamples/.github/.github/workflows/reusable-docker-build.yaml@gha-reusable-init
|
|
|
|
+
|
|
|
|
+ permissions:
|
|
|
|
+ contents: read
|
|
|
|
+ packages: write # needed to push docker image to ghcr.io
|
|
|
|
+ pull-requests: write # needed to create and update comments in PRs
|
|
|
|
+
|
|
|
|
+ secrets:
|
|
|
|
+
|
|
|
|
+ # Only needed if with:dockerhub-enable is true below
|
|
|
|
+ dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
+
|
|
|
|
+ # Only needed if with:dockerhub-enable is true below
|
|
|
|
+ dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
+
|
|
|
|
+ with:
|
|
|
|
+
|
|
|
|
+ ### REQUIRED
|
|
|
|
+ ### ENABLE ONE OR BOTH REGISTRIES
|
|
|
|
+ ### tell docker where to push.
|
|
|
|
+ ### NOTE if Docker Hub is set to true, you must set secrets above and also add account/repo/tags below
|
|
|
|
+ dockerhub-enable: false
|
|
|
|
+ ghcr-enable: true
|
|
|
|
+
|
|
|
|
+ ### REQUIRED
|
|
|
|
+ ### A list of the account/repo names for docker build. List should match what's enabled above
|
|
|
|
+ ### defaults to:
|
|
|
|
+ image-names: |
|
|
|
|
+ dockersamples/examplevotingapp_worker
|
|
|
|
+ ghcr.io/dockersamples/example-voting-app-worker
|
|
|
|
+
|
|
|
|
+ ### REQUIRED set rules for tagging images, based on special action syntax:
|
|
|
|
+ ### https://github.com/docker/metadata-action#tags-input
|
|
|
|
+ ### defaults to:
|
|
|
|
+ # tag-rules: |
|
|
|
|
+ # type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
|
|
|
|
+ # type=ref,event=pr
|
|
|
|
+ # type=ref,event=branch
|
|
|
|
+ # type=semver,pattern={{version}}
|
|
|
|
+ # type=raw,value=gha-${{ github.run_id }}
|
|
|
|
+
|
|
|
|
+ ### path to where docker should copy files into image
|
|
|
|
+ ### defaults to root of repository (.)
|
|
|
|
+ context: worker
|
|
|
|
+
|
|
|
|
+ ### Dockerfile alternate name. Default is Dockerfile (relative to context path)
|
|
|
|
+ # file: Containerfile
|
|
|
|
+
|
|
|
|
+ ### build stage to target, defaults to empty, which builds to last stage in Dockerfile
|
|
|
|
+ # target:
|
|
|
|
+
|
|
|
|
+ ### platforms to build for, defaults to linux/amd64
|
|
|
|
+ ### other options: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
+ platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
+
|
|
|
|
+ ### Create a PR comment with image tags and labels
|
|
|
|
+ ### defaults to false
|
|
|
|
+ # comment-enable: false
|