-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (58 loc) · 1.99 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: "Docker reusable workflow"
on:
workflow_call:
inputs:
with-push:
description: "determines if to push docker image to an image registry. Defaults to 'false'"
default: false
type: boolean
required: false
image-tag:
description: "docker image tag. Defaults to 'latest'"
default: "latest"
type: string
required: false
image-architectures:
description: "comma separated list of architectures. Defaults to 'linux/amd64,linux/arm64'"
required: false
type: string
default: linux/amd64,linux/arm64
env:
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: ${{ inputs.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: ${{ inputs.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 }}