-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (96 loc) · 3.25 KB
/
docker.yml
File metadata and controls
102 lines (96 loc) · 3.25 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright © TUM AET 2025 - 2025
#
# Licensed under the MIT License
#
# Authors: Benedikt Hofmann, Patrick Stoeckle, and other contributors
#
# SPDX-FileCopyrightText: 2025 TUM AET
#
# SPDX-License-Identifier: MIT
name: container image building
on:
workflow_call:
inputs:
image-registry:
description: The container registry to push the image to
required: false
type: string
default: ghcr.io
image-name:
description: The name of the image to build and push
required: true
type: string
context:
description: The build context for the Docker image
required: true
type: string
dockerfile:
description: The path to the Dockerfile
required: true
type: string
image-tag:
description: The tag for the built image
required: true
type: string
image-title:
description: The title of the image
required: true
type: string
image-description:
description: The description of the image
required: true
type: string
image-authors:
description: The authors of the image
required: true
type: string
outputs:
image-digest:
description: The digest of the built image
value: ${{ jobs.build-and-push.outputs.image-digest }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
# Can read the contents of the repository
contents: read
# Can write to the packages in the repository
# This is needed to push the built image to the GitHub Container Registry
packages: write
outputs:
image-digest: ${{ steps.docker_build.outputs.digest }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Login to GHCR
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
with:
registry: ${{ inputs.image-registry }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0
- name: Extract metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ inputs.image-name }}
annotations: |
org.opencontainers.image.title=${{ inputs.image-title }}
org.opencontainers.image.authors=${{ inputs.image-authors }}
org.opencontainers.image.description=${{ inputs.image-description }}
org.opencontainers.image.vendor=TUM AET
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
id: docker_build
with:
context: "${{ inputs.context }}"
file: "${{ inputs.dockerfile }}"
platforms: "linux/amd64,linux/arm64"
annotations: ${{ steps.meta.outputs.annotations }}
push: true
tags: ${{ inputs.image-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}