-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (82 loc) · 2.78 KB
/
image_one.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
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
name: _step.image_one
on:
workflow_call:
inputs:
dockerfile_name:
type: string
required: true
build_args:
type: string
required: true
base_target_tags:
type: string
required: true
image_name:
type: string
required: true
image_tag_maker_script:
type: string
required: true
outputs:
imageid:
description: Image ID
value: ${{ jobs.image.outputs.imageid }}
digest:
description: Image digest
value: ${{ jobs.image.outputs.digest }}
jobs:
image:
runs-on: ubuntu-latest
outputs:
imageid: ${{ steps.build.outputs.imageid }}
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4
- id: config
uses: actions/github-script@v7
with:
script: ${{ inputs.image_tag_maker_script }}
env:
BASE_TARGET_TAGS: ${{ inputs.base_target_tags }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: fallenbreath
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.image_name }}
tags: ${{ steps.config.outputs.target_tags }}
- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
file: src/${{ inputs.dockerfile_name }}
context: src
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |-
BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom
${{ inputs.build_args }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Report build information
run: |
echo -e "### Inputs\n" >> $GITHUB_STEP_SUMMARY
echo -e "- dockerfile_name: \`${{ inputs.dockerfile_name }}\`" >> $GITHUB_STEP_SUMMARY
echo -e "- build_args: \`${{ inputs.build_args }}\`" >> $GITHUB_STEP_SUMMARY
echo -e "- base_target_tags: \`${{ inputs.base_target_tags }}\`" >> $GITHUB_STEP_SUMMARY
echo -e "- image_name: \`${{ inputs.image_name }}\`" >> $GITHUB_STEP_SUMMARY
echo -e "" >> $GITHUB_STEP_SUMMARY
echo -e "### Image tags\n" >> $GITHUB_STEP_SUMMARY
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo -e "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY