Skip to content

Commit

Permalink
upd: publish to docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
leafmoes committed Nov 5, 2024
1 parent 112d99d commit 338730e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
GHCR_REPO: ghcr.io/leafmoes/ddg-chat
DOCKER_HUB_REPO: leafmoes/ddg-chat

jobs:
docker:
Expand All @@ -31,8 +32,18 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Build and push
- name: Build and push to GitHub Container Registry
uses: docker/build-push-action@v6
with:
context: .
Expand All @@ -41,6 +52,19 @@ jobs:
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_REPO }}:lates1314521t
${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
ddg-chat:
image: ghcr.io/leafmoes/ddg-chat:latest
image: leafmoes/ddg-chat:latest
container_name: ddg-chat
restart: unless-stopped
ports:
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ npm install

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

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

0 comments on commit 338730e

Please sign in to comment.