Skip to content

Commit 1cc3163

Browse files
committed
feat(build-push): allow more configs for building the img
1 parent fa6a74b commit 1cc3163

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/all-build-push-scan-harbor.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ on:
1313
type: string
1414
registry:
1515
description: 'Docker registry URL'
16-
required: true
16+
required: false
1717
type: string
18+
default: 'registry.mconf.com'
1819
dockerfile_path:
1920
description: 'Path to Dockerfile'
2021
required: false
@@ -30,6 +31,16 @@ on:
3031
type: string
3132
required: false
3233
default: ''
34+
context_path:
35+
description: 'Path to build context directory'
36+
type: string
37+
required: false
38+
default: '.'
39+
build_target:
40+
description: 'Docker build target stage for multi-stage builds'
41+
type: string
42+
required: false
43+
default: ''
3344
push_enabled:
3445
description: 'Enable pushing to registry (default: auto-detect tags)'
3546
type: boolean
@@ -77,6 +88,9 @@ jobs:
7788
name: Build, Push and Scan Docker
7889
runs-on: ${{ fromJSON(inputs.runs-on) }}
7990
timeout-minutes: 30
91+
outputs:
92+
image_digest: ${{ steps.build.outputs.digest }}
93+
image_tags: ${{ steps.meta.outputs.tags }}
8094
env:
8195
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
8296
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
@@ -138,8 +152,9 @@ jobs:
138152
id: build
139153
uses: docker/build-push-action@v5
140154
with:
141-
context: .
155+
context: ${{ inputs.context_path }}
142156
file: ${{ inputs.dockerfile_path }}
157+
target: ${{ inputs.build_target }}
143158
ssh: ${{ env.SSH_PRIVATE_KEY != '' && format('default={0}', env.SSH_AUTH_SOCK) || '' }}
144159
push: ${{ env.PUSH_ENABLED == 'true' }}
145160
load: ${{ env.SCAN_ENABLED == 'true' }}

0 commit comments

Comments
 (0)