Skip to content

Commit 65db8c9

Browse files
author
YourGitHubUsername
committed
ci(docker): 修改Docker构建流程仅构建本地镜像
将Docker构建工作流改为仅构建本地镜像而不推送,并使用localhost前缀的标签以避免意外推送
1 parent dfc80de commit 65db8c9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ jobs:
5353
username: ${{ github.actor }}
5454
password: ${{ secrets.GITHUB_TOKEN }}
5555

56-
# 构建镜像,如果是main或master分支则同时推送
57-
- name: Build and push Docker image
56+
# 只构建本地镜像,不推送
57+
- name: Build Docker image
5858
uses: docker/build-push-action@v5
5959
with:
6060
context: .
6161
file: ./Dockerfile
62-
# 只有推送到main或master分支时才推送镜像
63-
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
64-
# 构建时使用本地标签,推送时使用ghcr.io标签
62+
# 明确不推送镜像
63+
push: false
64+
# 使用localhost前缀的本地标签,避免Docker尝试推送到docker.io
6565
tags: |
66-
encryption-service:local
66+
localhost/encryption-service:local
6767
cache-from: type=local,src=/tmp/.buildx-cache
6868
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
6969
build-args: |

0 commit comments

Comments
 (0)