-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (100 loc) · 3.13 KB
/
Copy pathimage-build.yml
File metadata and controls
111 lines (100 loc) · 3.13 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
103
104
105
106
107
108
109
110
111
name: Container Image Generation
description: Create and publish a container image
on:
workflow_call:
inputs:
base-tag:
required: true
type: string
working-directory:
required: true
type: string
image-name-prefix:
required: true
type: string
image-name-suffix:
required: true
type: string
image-cache-suffix:
required: false
type: string
default: buildcache
platforms:
required: false
default: "linux/amd64"
type: string
dockerfile:
required: false
default: Dockerfile
type: string
registry:
required: false
default: "ghcr.io"
type: string
build-args:
required: false
default: ""
type: string
cache-key:
required: false
default: ${{ github.ref_name }}
type: string
secrets:
username:
required: true
password:
required: true
jobs:
deprecation-notice:
name: Deprecated
runs-on: ubuntu-latest
steps:
- name: Report deprecation
run: |
MESSAGE="This workflow is deprecated and will be removed. Use plone/meta/.github/workflows/container-image-build-push.yml@2.x instead."
echo "::warning title=Deprecated workflow::${MESSAGE}"
{
echo "> [!WARNING]"
echo "> ${MESSAGE}"
} >> "$GITHUB_STEP_SUMMARY"
build:
name: "Image ${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}:${{ inputs.base-tag }}"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}
flavor:
latest=false
tags: |
type=raw,value=${{ inputs.base-tag }}
- name: Login to Container Registry
uses: docker/login-action@v4
with:
registry: ${{ inputs.registry }}
username: ${{ secrets.username }}
password: ${{ secrets.password }}
- name: Build Image
uses: docker/build-push-action@v7
with:
context: ${{ inputs.working-directory }}
file: ${{ inputs.working-directory }}/${{ inputs.dockerfile }}
platforms: ${{ inputs.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
cache-from: type=registry,ref=${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}:${{ inputs.image-cache-suffix }}-${{ inputs.cache-key }}
cache-to: type=registry,ref=${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}:${{ inputs.image-cache-suffix }}-${{ inputs.base-tag }},mode=max
build-args: ${{ inputs.build-args }}