-
Notifications
You must be signed in to change notification settings - Fork 7
60 lines (58 loc) · 2.09 KB
/
Copy pathreusable--docker-build.yaml
File metadata and controls
60 lines (58 loc) · 2.09 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
name: docker-build
on:
workflow_call:
inputs:
images:
description: Passed to docker/metadata-action
type: string
required: true
cache-image:
description: Passed to int128/docker-build-cache-config-action
type: string
required: true
context:
description: Passed to docker/build-push-action
type: string
required: true
platforms:
description: Passed to docker/build-push-action
type: string
required: true
outputs:
image-uri:
description: Image URI
value: ${{ jobs.build.outputs.image-uri }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
image-uri: ghcr.io/${{ github.repository }}/e2e@${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
id: metadata
with:
images: ${{ inputs.images }}
# avoid overwriting the latest tag because metadata-action does not add a suffix to it
flavor: latest=false,suffix=-amd64
- uses: int128/docker-build-cache-config-action@53682992e5c4634237e64ae138af741c3ce1cdaa # v1.70.0
id: cache
with:
image: ${{ inputs.cache-image }}
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
id: build
with:
push: true
context: ${{ inputs.context }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
platforms: ${{ inputs.platforms }}