@@ -3,12 +3,27 @@ name: Docker
33on : [workflow_dispatch, push]
44
55env :
6- IMAGE_NAME : monero
6+ MONERO_IMAGE_NAME : monero
7+ EXPORTER_IMAGE_NAME : monero-exporter
78 PLATFORMS : linux/amd64,linux/arm64/v8,linux/arm/v7
89
910jobs :
10- build :
11- name : Build
11+ check-changes :
12+ name : Check Changes (Exporter)
13+ runs-on : ubuntu-latest
14+ outputs :
15+ exporter_changed : ${{ steps.changes.outputs.exporter }}
16+ steps :
17+ - uses : actions/checkout@v4
18+ - id : changes
19+ uses : dorny/paths-filter@v3
20+ with :
21+ filters : |
22+ exporter:
23+ - 'Dockerfile.prom-exporter'
24+
25+ build-monero :
26+ name : Build Monero
1227 runs-on : ${{ matrix.runs-on }}
1328 strategy :
1429 matrix :
@@ -18,11 +33,42 @@ jobs:
1833 runs-on : ubuntu-latest
1934 platform : linux/amd64
2035 - arch : arm64
21- # https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/
2236 runs-on : ubuntu-24.04-arm
2337 platform : linux/arm64
2438 - arch : armv7
39+ runs-on : ubuntu-24.04-arm
40+ platform : linux/arm/v7
41+ steps :
42+ - uses : actions/checkout@v4
43+ - uses : docker/setup-qemu-action@v3
44+ - uses : docker/setup-buildx-action@v3
45+ - uses : docker/build-push-action@v6
46+ with :
47+ platforms : ${{ matrix.platform }}
48+ push : false
49+ cache-from : |
50+ type=gha,scope=monero-build-${{ matrix.arch }}
51+ cache-to : |
52+ type=gha,mode=max,scope=monero-build-${{ matrix.arch }}
53+ context : .
54+
55+ build-exporter :
56+ name : Build Exporter
57+ needs : [check-changes]
58+ if : needs.check-changes.outputs.exporter_changed == 'true'
59+ runs-on : ${{ matrix.runs-on }}
60+ strategy :
61+ matrix :
62+ arch : [amd64, arm64, armv7]
63+ include :
64+ - arch : amd64
2565 runs-on : ubuntu-latest
66+ platform : linux/amd64
67+ - arch : arm64
68+ runs-on : ubuntu-24.04-arm
69+ platform : linux/arm64
70+ - arch : armv7
71+ runs-on : ubuntu-24.04-arm
2672 platform : linux/arm/v7
2773 steps :
2874 - uses : actions/checkout@v4
@@ -32,14 +78,16 @@ jobs:
3278 with :
3379 platforms : ${{ matrix.platform }}
3480 push : false
81+ file : Dockerfile.prom-exporter
3582 cache-from : |
36- type=gha,scope=docker -build-${{ matrix.arch }}
83+ type=gha,scope=exporter -build-${{ matrix.arch }}
3784 cache-to : |
38- type=gha,mode=max,scope=docker -build-${{ matrix.arch }}
85+ type=gha,mode=max,scope=exporter -build-${{ matrix.arch }}
3986 context : .
40- combine :
41- name : Combine
42- needs : [build]
87+
88+ combine-monero :
89+ name : Combine Monero
90+ needs : [build-monero]
4391 runs-on : ubuntu-latest
4492 permissions :
4593 contents : read
@@ -74,9 +122,55 @@ jobs:
74122 tags : ${{ steps.meta.outputs.tags }}
75123 labels : ${{ steps.meta.outputs.labels }}
76124 cache-from : |
77- type=gha,scope=docker-package
78- type=gha,scope=docker-build-amd64
79- type=gha,scope=docker-build-arm64
80- type=gha,scope=docker-build-armv7
125+ type=gha,scope=monero-package
126+ type=gha,scope=monero-build-amd64
127+ type=gha,scope=monero-build-arm64
128+ type=gha,scope=monero-build-armv7
129+ cache-to : |
130+ type=gha,mode=max,scope=monero-package
131+
132+ combine-exporter :
133+ name : Combine Exporter
134+ needs : [check-changes, build-exporter]
135+ if : needs.check-changes.outputs.exporter_changed == 'true'
136+ runs-on : ubuntu-latest
137+ permissions :
138+ contents : read
139+ packages : write
140+ steps :
141+ - uses : actions/checkout@v4
142+ - uses : docker/setup-qemu-action@v3
143+ - uses : docker/setup-buildx-action@v3
144+ - uses : docker/login-action@v3
145+ with :
146+ registry : ghcr.io
147+ username : ${{ github.repository_owner }}
148+ password : ${{ github.token }}
149+ - uses : docker/login-action@v3
150+ with :
151+ username : ${{ secrets.DOCKERHUB_USERNAME }}
152+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
153+ - uses : docker/metadata-action@v5
154+ id : meta
155+ with :
156+ images : |
157+ ghcr.io/${{ github.repository_owner }}/monero-exporter
158+ docker.io/rblaine/monero-exporter
159+ tags : |
160+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
161+ type=raw,value={{branch}},enable=${{ github.ref != format('refs/heads/{0}', 'master') }}
162+ type=ref,event=tag
163+ - uses : docker/build-push-action@v6
164+ with :
165+ platforms : ${{ env.PLATFORMS }}
166+ push : true
167+ file : Dockerfile.prom-exporter
168+ tags : ${{ steps.meta.outputs.tags }}
169+ labels : ${{ steps.meta.outputs.labels }}
170+ cache-from : |
171+ type=gha,scope=exporter-package
172+ type=gha,scope=exporter-build-amd64
173+ type=gha,scope=exporter-build-arm64
174+ type=gha,scope=exporter-build-armv7
81175 cache-to : |
82- type=gha,mode=max,scope=docker -package
176+ type=gha,mode=max,scope=exporter -package
0 commit comments