-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.05 KB
/
build-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
name: Build and push Docker image
on:
workflow_dispatch:
inputs:
image_name:
description: "Name of the Docker image"
required: true
default: "my-image"
image_tag:
description: "Tag of the Docker image"
required: true
default: "v0.0.1"
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
attestations: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Docker build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ inputs.image_name }}:${{ inputs.image_tag }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ inputs.image_name }}
subject-digest: ${{ steps.docker_build.outputs.digest }}
push-to-registry: true