Skip to content

Commit 44fa6a7

Browse files
authored
Update docker-image.yml
1 parent 8d48a57 commit 44fa6a7

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

Diff for: .github/workflows/docker-image.yml

+25-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,33 @@ on:
55
branches: [ "master" ]
66
pull_request:
77
branches: [ "master" ]
8-
98
jobs:
109

1110
build:
12-
1311
runs-on: ubuntu-latest
14-
1512
steps:
16-
- uses: actions/checkout@v4
17-
- name: Build the Docker image
18-
run: docker build . --file Dockerfile --tag bysir/drone-qiniu:latest
13+
- uses: actions/checkout@v3
14+
15+
# https://github.com/docker/login-action
16+
# get at https://hub.docker.com/settings/security, set on Github repository settings/secrets/actions
17+
- name: Login to Docker Hub
18+
uses: docker/login-action@v2
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
# Extract metadata (tags, labels) for Docker
24+
# https://github.com/docker/metadata-action
25+
- name: Extract Docker metadata
26+
id: meta
27+
uses: docker/metadata-action@v4
28+
with:
29+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
30+
31+
# https://github.com/docker/build-push-action#git-context
32+
- name: Build and push Docker
33+
uses: docker/build-push-action@v3
34+
with:
35+
push: true
36+
tags: ${{ steps.meta.outputs.tags }}
37+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)