Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 338730e

Browse files
committed
upd: publish to docker hub
1 parent 112d99d commit 338730e

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

.github/workflows/docker-image.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
env:
1313
GHCR_REPO: ghcr.io/leafmoes/ddg-chat
14+
DOCKER_HUB_REPO: leafmoes/ddg-chat
1415

1516
jobs:
1617
docker:
@@ -31,8 +32,18 @@ jobs:
3132
registry: ghcr.io
3233
username: ${{ github.repository_owner }}
3334
password: ${{ secrets.GHCR_PAT }}
35+
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v2
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
41+
42+
- name: Get short SHA
43+
id: slug
44+
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
3445

35-
- name: Build and push
46+
- name: Build and push to GitHub Container Registry
3647
uses: docker/build-push-action@v6
3748
with:
3849
context: .
@@ -41,6 +52,19 @@ jobs:
4152
push: true
4253
tags: |
4354
${{ env.GHCR_REPO }}:latest
44-
${{ env.GHCR_REPO }}:${{ github.sha }}
55+
${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
59+
- name: Build and push to Docker Hub
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: .
63+
platforms: linux/amd64,linux/arm64
64+
file: Dockerfile
65+
push: true
66+
tags: |
67+
${{ env.DOCKER_HUB_REPO }}:lates1314521t
68+
${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }}
4569
cache-from: type=gha
4670
cache-to: type=gha,mode=max

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3'
22

33
services:
44
ddg-chat:
5-
image: ghcr.io/leafmoes/ddg-chat:latest
5+
image: leafmoes/ddg-chat:latest
66
container_name: ddg-chat
77
restart: unless-stopped
88
ports:

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ npm install
130130

131131
方法一:命令行构建
132132
```bash
133-
docker run -it -d --name ddg-chat -p 8787:8787 ghcr.io/leafmoes/ddg-chat:latest
133+
docker run -it -d --name ddg-chat -p 8787:8787 leafmoes/ddg-chat:latest
134134
```
135135

136136
方法二:使用 `docker-compose.yml` 文件构建

0 commit comments

Comments
 (0)