Skip to content

Commit

Permalink
ci(docker): push to ghcr.io (#642)
Browse files Browse the repository at this point in the history
* ci(docker): push to `ghcr.io`

By adding the steps to login to `ghcr.io` and adding the `ghcr.io` image to do this.

Also, replaces text that can be replaced by secret with secret.

* docs: wrong `ghcr.io` link

* fix(ci): wrong `ghcr.io` image and username
  • Loading branch information
WaterLemons2k authored Mar 21, 2023
1 parent 962dee0 commit b1d29eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
buildx-dockerhub:
runs-on: ubuntu-latest
env:
DOCKER_REPO: jeessy/ddns-go
DOCKER_REPO: ${{ secrets.DOCKER_USERNAME }}/ddns-go
DOCKER_PLATFORMS: linux/amd64,linux/arm,linux/arm64
steps:
- name: Checkout
Expand All @@ -21,16 +21,24 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_REPO }}
images: |
${{ env.DOCKER_REPO }}
ghcr.io/${{ github.repository }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
- name: Docker login # login to docker hub, automatically logout at the end of job
- name: Login to Docker Hub # login to Docker Hub, automatically logout at the end of job
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run buildx and push
uses: docker/build-push-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: jeessy/ddns-go
repository: ${{ secrets.DOCKER_USERNAME }}/ddns-go
short-description: ${{ github.event.repository.description }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@

- 在浏览器中打开`http://主机IP:9876`,修改你的配置,成功

- [可选] 使用 `ghcr.io` 镜像

```bash
docker run -d --name ddns-go --restart=always --net=host -v /opt/ddns-go:/root ghcr.io/jeessy2/ddns-go
```

- [可选] 支持启动带参数 `-l`监听地址 `-f`间隔时间(秒)

```bash
Expand Down

0 comments on commit b1d29eb

Please sign in to comment.