Skip to content

Commit eee2679

Browse files
possebonclaude
andcommitted
ci: switch Docker image registry from Docker Hub to GHCR
Rewrites all 3 publish workflows to push to ghcr.io/kennis-ai/evolution-api instead of Docker Hub (evoapicloud/evolution-api). Uses built-in GITHUB_TOKEN for auth (zero secrets config), adds GHA build cache, and fixes command injection pattern in digest echo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bd2fe39 commit eee2679

3 files changed

Lines changed: 59 additions & 27 deletions

File tree

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
name: Build Docker image
1+
name: Build Docker image (release)
22

33
on:
44
push:
55
tags:
66
- "*.*.*"
77

8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
812
jobs:
913
build_deploy:
10-
name: Build and Deploy
14+
name: Build and Push
1115
runs-on: ubuntu-latest
1216
permissions:
1317
contents: read
1418
packages: write
1519
steps:
1620
- name: Checkout
17-
uses: actions/checkout@v5
21+
uses: actions/checkout@v4
1822
with:
1923
submodules: recursive
2024

2125
- name: Docker meta
2226
id: meta
2327
uses: docker/metadata-action@v5
2428
with:
25-
images: evoapicloud/evolution-api
26-
tags: type=semver,pattern=v{{version}}
29+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
30+
tags: |
31+
type=semver,pattern={{version}}
32+
type=semver,pattern={{major}}.{{minor}}
2733
2834
- name: Set up QEMU
2935
uses: docker/setup-qemu-action@v3
@@ -34,17 +40,23 @@ jobs:
3440
- name: Login to GitHub Container Registry
3541
uses: docker/login-action@v3
3642
with:
37-
username: ${{ secrets.DOCKER_USERNAME }}
38-
password: ${{ secrets.DOCKER_PASSWORD }}
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
3946

4047
- name: Build and push
4148
id: docker_build
4249
uses: docker/build-push-action@v6
4350
with:
51+
context: .
4452
platforms: linux/amd64,linux/arm64
4553
push: true
4654
tags: ${{ steps.meta.outputs.tags }}
4755
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
4858

49-
- name: Image digest
50-
run: echo ${{ steps.docker_build.outputs.digest }}
59+
- name: Summary
60+
env:
61+
DIGEST: ${{ steps.docker_build.outputs.digest }}
62+
run: echo "Image digest: $DIGEST"
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
name: Build Docker image
1+
name: Build Docker image (homolog)
22

33
on:
44
push:
55
branches:
66
- develop
77

8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
812
jobs:
913
build_deploy:
10-
name: Build and Deploy
14+
name: Build and Push
1115
runs-on: ubuntu-latest
1216
permissions:
1317
contents: read
1418
packages: write
1519
steps:
1620
- name: Checkout
17-
uses: actions/checkout@v5
21+
uses: actions/checkout@v4
1822
with:
1923
submodules: recursive
2024

2125
- name: Docker meta
2226
id: meta
2327
uses: docker/metadata-action@v5
2428
with:
25-
images: evoapicloud/evolution-api
29+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
2630
tags: homolog
2731

2832
- name: Set up QEMU
@@ -31,20 +35,26 @@ jobs:
3135
- name: Set up Docker Buildx
3236
uses: docker/setup-buildx-action@v3
3337

34-
- name: Login to Docker Hub
38+
- name: Login to GitHub Container Registry
3539
uses: docker/login-action@v3
3640
with:
37-
username: ${{ secrets.DOCKER_USERNAME }}
38-
password: ${{ secrets.DOCKER_PASSWORD }}
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
3944

4045
- name: Build and push
4146
id: docker_build
4247
uses: docker/build-push-action@v6
4348
with:
49+
context: .
4450
platforms: linux/amd64,linux/arm64
4551
push: true
4652
tags: ${{ steps.meta.outputs.tags }}
4753
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
4856

49-
- name: Image digest
50-
run: echo ${{ steps.docker_build.outputs.digest }}
57+
- name: Summary
58+
env:
59+
DIGEST: ${{ steps.docker_build.outputs.digest }}
60+
run: echo "Image digest: $DIGEST"
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
name: Build Docker image
1+
name: Build Docker image (latest)
22

33
on:
44
push:
55
branches:
66
- main
77

8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
812
jobs:
913
build_deploy:
10-
name: Build and Deploy
14+
name: Build and Push
1115
runs-on: ubuntu-latest
1216
permissions:
1317
contents: read
1418
packages: write
1519
steps:
1620
- name: Checkout
17-
uses: actions/checkout@v5
21+
uses: actions/checkout@v4
1822
with:
1923
submodules: recursive
2024

2125
- name: Docker meta
2226
id: meta
2327
uses: docker/metadata-action@v5
2428
with:
25-
images: evoapicloud/evolution-api
29+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
2630
tags: latest
2731

2832
- name: Set up QEMU
@@ -31,20 +35,26 @@ jobs:
3135
- name: Set up Docker Buildx
3236
uses: docker/setup-buildx-action@v3
3337

34-
- name: Login to Docker Hub
38+
- name: Login to GitHub Container Registry
3539
uses: docker/login-action@v3
3640
with:
37-
username: ${{ secrets.DOCKER_USERNAME }}
38-
password: ${{ secrets.DOCKER_PASSWORD }}
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
3944

4045
- name: Build and push
4146
id: docker_build
4247
uses: docker/build-push-action@v6
4348
with:
49+
context: .
4450
platforms: linux/amd64,linux/arm64
4551
push: true
4652
tags: ${{ steps.meta.outputs.tags }}
4753
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
4856

49-
- name: Image digest
50-
run: echo ${{ steps.docker_build.outputs.digest }}
57+
- name: Summary
58+
env:
59+
DIGEST: ${{ steps.docker_build.outputs.digest }}
60+
run: echo "Image digest: $DIGEST"

0 commit comments

Comments
 (0)