File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish Docker image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ tags :
8+ - " v*"
9+ workflow_dispatch :
10+
11+ env :
12+ REGISTRY : ghcr.io
13+ IMAGE_NAME : ${{ github.repository }}
14+
15+ jobs :
16+ docker :
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ packages : write
21+
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+
26+ - name : Set up QEMU
27+ uses : docker/setup-qemu-action@v3
28+
29+ - name : Set up Docker Buildx
30+ uses : docker/setup-buildx-action@v3
31+
32+ - name : Log in to GHCR
33+ uses : docker/login-action@v3
34+ with :
35+ registry : ${{ env.REGISTRY }}
36+ username : ${{ github.actor }}
37+ password : ${{ secrets.GITHUB_TOKEN }}
38+
39+ - name : Extract image metadata
40+ id : meta
41+ uses : docker/metadata-action@v5
42+ with :
43+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+ tags : |
45+ type=ref,event=branch
46+ type=ref,event=tag
47+ type=sha
48+ type=raw,value=latest,enable={{is_default_branch}}
49+
50+ - name : Build and push image
51+ uses : docker/build-push-action@v6
52+ with :
53+ context : .
54+ push : true
55+ platforms : linux/amd64,linux/arm64
56+ tags : ${{ steps.meta.outputs.tags }}
57+ labels : ${{ steps.meta.outputs.labels }}
58+ cache-from : type=gha
59+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change @@ -122,3 +122,24 @@ The compose service includes Docker log rotation using:
122122
123123- ` max-size: 10m `
124124- ` max-file: 3 `
125+
126+ ## Prebuilt Image (GHCR)
127+
128+ This repository includes a GitHub Actions workflow at ` .github/workflows/docker-publish.yml ` .
129+
130+ - On each push to ` main ` , it builds and publishes a multi-arch image to GHCR.
131+ - On tags like ` v1.0.0 ` , it also publishes tag-based versions.
132+ - You can also run it manually from the Actions tab (` workflow_dispatch ` ).
133+
134+ Published image name:
135+
136+ ``` text
137+ ghcr.io/vdw/hetzner_ddns
138+ ```
139+
140+ Run prebuilt image on a server:
141+
142+ ``` bash
143+ docker pull ghcr.io/vdw/hetzner_ddns:latest
144+ docker run -d --name hetzner-ddns --restart unless-stopped --env-file .env ghcr.io/vdw/hetzner_ddns:latest
145+ ```
You can’t perform that action at this time.
0 commit comments