-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate docker CI job, build image from feature branches
- Loading branch information
1 parent
cfe4e88
commit 4058330
Showing
3 changed files
with
75 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "Docker reusable workflow" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
with-push: | ||
description: "determines if to push docker image to an image registry, otherwise will just build" | ||
default: false | ||
type: boolean | ||
required: false | ||
image-tag: | ||
description: "docker image tag. Defaults to 'latest'" | ||
default: "latest" | ||
type: string | ||
required: false | ||
|
||
env: | ||
IMAGE_ARCHITECTURES: linux/amd64,linux/arm64 | ||
IMAGE_REGISTRY: ghcr.io | ||
DOCKERFILE_PATH: build/Dockerfile | ||
IMAGE_DESCRIPTION: | | ||
This Docker image is a CLI tool for evaluating the health and severity of various SSV client related metrics over time. | ||
jobs: | ||
docker: | ||
name: Build/Push Docker Image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: read | ||
env: | ||
IMAGE_TAG: ${{ inputs.image-tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: ${{ env.IMAGE_ARCHITECTURES }} | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKERFILE_PATH }} | ||
push: ${{ inputs.with-push }} | ||
platforms: ${{ env.IMAGE_ARCHITECTURES }} | ||
tags: | | ||
${{ env.IMAGE_REGISTRY }}/${{ github.repository }}:${{ env.IMAGE_TAG }} | ||
${{ env.IMAGE_REGISTRY }}/${{ github.repository }}:latest | ||
outputs: | | ||
type=image,name=target,annotation-index.org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters