-
Notifications
You must be signed in to change notification settings - Fork 28
40 lines (37 loc) · 1.14 KB
/
build-image-semver.yml
File metadata and controls
40 lines (37 loc) · 1.14 KB
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
---
name: Build and push semver-tagged Docker image
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
permissions:
contents: read # principle of least privilege
jobs:
build:
name: Build and push semver-tagged Docker image
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx for multi-platform builds
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ vars.PLATFORMS }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Derive image tag(s)
uses: docker/metadata-action@v5
with:
images: >-
${{ secrets.DOCKERHUB_ORGANIZATION_NAME }}/${{ vars.IMAGE_NAME }}
tags: type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ vars.PLATFORMS }}
push: true
sbom: true
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}