Skip to content

Commit b2bfc04

Browse files
committed
ci(docker): Optimize Docker build workflow and configuration
- Add environment variable for Docker registry image to reduce duplication - Set job timeout to 60 minutes to prevent hanging builds - Update docker/build-push-action from v5 to v6 for latest features - Configure Docker Buildx with moby/buildkit:latest and host network - Disable provenance attestation to improve build performance - Replace hardcoded registry image reference with env variable for maintainability
1 parent 900541b commit b2bfc04

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/docker-image.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ on:
88
tags:
99
- 'v*'
1010

11+
env:
12+
REGISTRY_IMAGE: ${{ secrets.DOCKER_USERNAME }}/filecodebox
13+
1114
jobs:
1215
buildx:
1316
runs-on: ubuntu-latest
17+
timeout-minutes: 60
1418
steps:
1519
- name: Checkout
1620
uses: actions/checkout@v4
@@ -21,7 +25,7 @@ jobs:
2125
id: meta
2226
uses: docker/metadata-action@v5
2327
with:
24-
images: ${{ secrets.DOCKER_USERNAME }}/filecodebox
28+
images: ${{ env.REGISTRY_IMAGE }}
2529
tags: |
2630
type=ref,event=branch
2731
type=ref,event=pr
@@ -35,6 +39,10 @@ jobs:
3539

3640
- name: Set up Docker Buildx
3741
uses: docker/setup-buildx-action@v3
42+
with:
43+
driver-opts: |
44+
image=moby/buildkit:latest
45+
network=host
3846
3947
- name: Login to DockerHub
4048
uses: docker/login-action@v3
@@ -43,7 +51,7 @@ jobs:
4351
password: ${{ secrets.DOCKER_PASSWORD }}
4452

4553
- name: Build and push
46-
uses: docker/build-push-action@v5
54+
uses: docker/build-push-action@v6
4755
with:
4856
context: .
4957
platforms: linux/amd64,linux/arm64
@@ -52,3 +60,4 @@ jobs:
5260
labels: ${{ steps.meta.outputs.labels }}
5361
cache-from: type=gha
5462
cache-to: type=gha,mode=max
63+
provenance: false

0 commit comments

Comments
 (0)