Skip to content

Commit 40a1aba

Browse files
committed
更新Docker工作流
1 parent 079d53a commit 40a1aba

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

.github/workflows/docker-image.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
name: Docker Image CI
1+
name: Docker Build and Push
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
5+
branches: [ main ]
86

97
jobs:
10-
118
build:
12-
139
runs-on: ubuntu-latest
14-
1510
steps:
16-
- uses: actions/checkout@v4
17-
- name: Build the Docker image
18-
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
11+
- uses: actions/checkout@v4
12+
- name: Log in to GitHub Container Registry
13+
uses: docker/login-action@v3
14+
with:
15+
registry: ghcr.io
16+
username: ${{ github.actor }}
17+
password: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Build and push Docker image
19+
uses: docker/build-push-action@v4
20+
with:
21+
context: .
22+
push: true
23+
tags: |
24+
ghcr.io/${{ github.repository }}:latest
25+
ghcr.io/${{ github.repository }}:${{ github.sha }}

0 commit comments

Comments
 (0)