Skip to content

Commit 182498d

Browse files
committed
Fix: build and push platform-specific images separately, then create multiarch manifests
1 parent 327fa90 commit 182498d

File tree

1 file changed

+152
-14
lines changed

1 file changed

+152
-14
lines changed

.github/workflows/docker-update-all-images-dockerhub.yml

Lines changed: 152 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,58 @@ jobs:
4848
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4949
password: ${{ secrets.DOCKER_HUB_TOKEN }}
5050

51-
- name: Build and push Base image
51+
- name: Build and push Base image for amd64
5252
uses: docker/build-push-action@v6
5353
with:
5454
context: ./docker/IMAGES
5555
file: ./docker/IMAGES/_Base.Dockerfile
56-
platforms: linux/amd64,linux/arm64
56+
platforms: linux/amd64
5757
push: true
5858
tags: |
59-
${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }}
6059
${{ env.BASE_IMAGE_NAME }}:amd64
60+
labels: |
61+
org.opencontainers.image.title=Rails Start Base
62+
org.opencontainers.image.description=Base Image with common software for Rails development
63+
org.opencontainers.image.source=${{ github.repository }}
64+
org.opencontainers.image.revision=${{ github.sha }}
65+
66+
- name: Build and push Base image for arm64
67+
uses: docker/build-push-action@v6
68+
with:
69+
context: ./docker/IMAGES
70+
file: ./docker/IMAGES/_Base.Dockerfile
71+
platforms: linux/arm64
72+
push: true
73+
tags: |
6174
${{ env.BASE_IMAGE_NAME }}:arm64
6275
labels: |
6376
org.opencontainers.image.title=Rails Start Base
6477
org.opencontainers.image.description=Base Image with common software for Rails development
6578
org.opencontainers.image.source=${{ github.repository }}
6679
org.opencontainers.image.revision=${{ github.sha }}
6780
81+
- name: Create and push Base multiarch manifest
82+
run: |
83+
docker manifest create \
84+
${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }} \
85+
--amend ${{ env.BASE_IMAGE_NAME }}:amd64 \
86+
--amend ${{ env.BASE_IMAGE_NAME }}:arm64
87+
docker manifest push ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }}
88+
docker manifest create \
89+
${{ env.BASE_IMAGE_NAME }}:latest \
90+
--amend ${{ env.BASE_IMAGE_NAME }}:amd64 \
91+
--amend ${{ env.BASE_IMAGE_NAME }}:arm64
92+
docker manifest push ${{ env.BASE_IMAGE_NAME }}:latest
93+
6894
- name: Base image pushed successfully
6995
if: success()
7096
run: |
7197
echo "✅ Base image pushed to Docker Hub!"
72-
echo "Tag: ${{ github.event.inputs.base_tag }}"
73-
echo "Platforms: linux/amd64, linux/arm64"
98+
echo "Tags:"
99+
echo " - ${{ env.BASE_IMAGE_NAME }}:amd64 (platform-specific)"
100+
echo " - ${{ env.BASE_IMAGE_NAME }}:arm64 (platform-specific)"
101+
echo " - ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }} (multiarch)"
102+
echo " - ${{ env.BASE_IMAGE_NAME }}:latest (multiarch)"
74103
75104
# ============================================================
76105
# Step 2: Build and push Main image (depends on Base)
@@ -98,25 +127,63 @@ jobs:
98127
username: ${{ secrets.DOCKER_HUB_USERNAME }}
99128
password: ${{ secrets.DOCKER_HUB_TOKEN }}
100129

101-
- name: Build and push Main image
130+
- name: Build and push Main image for amd64
102131
uses: docker/build-push-action@v6
103132
with:
104133
context: ./docker/IMAGES
105134
file: ./docker/IMAGES/_Main.Dockerfile
106-
platforms: linux/amd64,linux/arm64
135+
platforms: linux/amd64
107136
push: true
108137
tags: |
109-
${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }}
110138
${{ env.MAIN_IMAGE_NAME }}:amd64
139+
build-args: |
140+
BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}:amd64
141+
labels: |
142+
org.opencontainers.image.title=Rails Start Main
143+
org.opencontainers.image.description=Main Rails Image with Ruby, Node.js and common tools
144+
org.opencontainers.image.source=${{ github.repository }}
145+
org.opencontainers.image.revision=${{ github.sha }}
146+
147+
- name: Build and push Main image for arm64
148+
uses: docker/build-push-action@v6
149+
with:
150+
context: ./docker/IMAGES
151+
file: ./docker/IMAGES/_Main.Dockerfile
152+
platforms: linux/arm64
153+
push: true
154+
tags: |
111155
${{ env.MAIN_IMAGE_NAME }}:arm64
112156
build-args: |
113-
BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }}
157+
BASE_IMAGE=${{ env.BASE_IMAGE_NAME }}:arm64
114158
labels: |
115159
org.opencontainers.image.title=Rails Start Main
116160
org.opencontainers.image.description=Main Rails Image with Ruby, Node.js and common tools
117161
org.opencontainers.image.source=${{ github.repository }}
118162
org.opencontainers.image.revision=${{ github.sha }}
119163
164+
- name: Create and push Main multiarch manifest
165+
run: |
166+
docker manifest create \
167+
${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }} \
168+
--amend ${{ env.MAIN_IMAGE_NAME }}:amd64 \
169+
--amend ${{ env.MAIN_IMAGE_NAME }}:arm64
170+
docker manifest push ${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }}
171+
docker manifest create \
172+
${{ env.MAIN_IMAGE_NAME }}:latest \
173+
--amend ${{ env.MAIN_IMAGE_NAME }}:amd64 \
174+
--amend ${{ env.MAIN_IMAGE_NAME }}:arm64
175+
docker manifest push ${{ env.MAIN_IMAGE_NAME }}:latest
176+
177+
- name: Main image pushed successfully
178+
if: success()
179+
run: |
180+
echo "✅ Main image pushed to Docker Hub!"
181+
echo "Tags:"
182+
echo " - ${{ env.MAIN_IMAGE_NAME }}:amd64 (platform-specific)"
183+
echo " - ${{ env.MAIN_IMAGE_NAME }}:arm64 (platform-specific)"
184+
echo " - ${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }} (multiarch)"
185+
echo " - ${{ env.MAIN_IMAGE_NAME }}:latest (multiarch)"
186+
120187
- name: Main image pushed successfully
121188
if: success()
122189
run: |
@@ -151,32 +218,103 @@ jobs:
151218
username: ${{ secrets.DOCKER_HUB_USERNAME }}
152219
password: ${{ secrets.DOCKER_HUB_TOKEN }}
153220

154-
- name: Build and push Media image
221+
- name: Build and push Media image for amd64
155222
uses: docker/build-push-action@v6
156223
with:
157224
context: ./docker/IMAGES
158225
file: ./docker/IMAGES/_Media.Dockerfile
159-
platforms: linux/amd64,linux/arm64
226+
platforms: linux/amd64
160227
push: true
161228
tags: |
162-
${{ env.MEDIA_IMAGE_NAME }}:${{ github.event.inputs.media_tag }}
163229
${{ env.MEDIA_IMAGE_NAME }}:amd64
230+
build-args: |
231+
BASE_IMAGE=${{ env.MAIN_IMAGE_NAME }}:amd64
232+
labels: |
233+
org.opencontainers.image.title=Rails Start Media
234+
org.opencontainers.image.description=Media Image with image and video processing tools
235+
org.opencontainers.image.source=${{ github.repository }}
236+
org.opencontainers.image.revision=${{ github.sha }}
237+
238+
- name: Build and push Media image for arm64
239+
uses: docker/build-push-action@v6
240+
with:
241+
context: ./docker/IMAGES
242+
file: ./docker/IMAGES/_Media.Dockerfile
243+
platforms: linux/arm64
244+
push: true
245+
tags: |
164246
${{ env.MEDIA_IMAGE_NAME }}:arm64
165247
build-args: |
166-
BASE_IMAGE=${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }}
248+
BASE_IMAGE=${{ env.MAIN_IMAGE_NAME }}:arm64
167249
labels: |
168250
org.opencontainers.image.title=Rails Start Media
169251
org.opencontainers.image.description=Media Image with image and video processing tools
170252
org.opencontainers.image.source=${{ github.repository }}
171253
org.opencontainers.image.revision=${{ github.sha }}
172254
255+
- name: Create and push Media multiarch manifest
256+
run: |
257+
docker manifest create \
258+
${{ env.MEDIA_IMAGE_NAME }}:${{ github.event.inputs.media_tag }} \
259+
--amend ${{ env.MEDIA_IMAGE_NAME }}:amd64 \
260+
--amend ${{ env.MEDIA_IMAGE_NAME }}:arm64
261+
docker manifest push ${{ env.MEDIA_IMAGE_NAME }}:${{ github.event.inputs.media_tag }}
262+
docker manifest create \
263+
${{ env.MEDIA_IMAGE_NAME }}:latest \
264+
--amend ${{ env.MEDIA_IMAGE_NAME }}:amd64 \
265+
--amend ${{ env.MEDIA_IMAGE_NAME }}:arm64
266+
docker manifest push ${{ env.MEDIA_IMAGE_NAME }}:latest
267+
268+
- name: Media image pushed successfully
269+
if: success()
270+
run: |
271+
echo "✅ Media image pushed to Docker Hub!"
272+
echo "Tags:"
273+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:amd64 (platform-specific)"
274+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:arm64 (platform-specific)"
275+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:${{ github.event.inputs.media_tag }} (multiarch)"
276+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:latest (multiarch)"
277+
173278
- name: Media image pushed successfully
174279
if: success()
175280
run: |
176281
echo "✅ Media image pushed to Docker Hub!"
177-
echo "Tag: ${{ github.event.inputs.media_tag }}"
178282
echo "Main image: ${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }}"
179283
echo "Platforms: linux/amd64, linux/arm64"
284+
echo "Tags: ${{ steps.tags.outputs.tags }}"
285+
286+
# ============================================================
287+
# Summary
288+
# ============================================================
289+
summary:
290+
name: Build Summary
291+
runs-on: ubuntu-latest
292+
needs: [build-base, build-main, build-media]
293+
if: always()
294+
295+
steps:
296+
- name: Build complete
297+
run: |
298+
echo "=========================================="
299+
echo "✅ All images built and pushed to Docker Hub!"
300+
echo "=========================================="
301+
echo ""
302+
echo "Platform-specific tags (single architecture):"
303+
echo " - ${{ env.BASE_IMAGE_NAME }}:amd64"
304+
echo " - ${{ env.BASE_IMAGE_NAME }}:arm64"
305+
echo " - ${{ env.MAIN_IMAGE_NAME }}:amd64"
306+
echo " - ${{ env.MAIN_IMAGE_NAME }}:arm64"
307+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:amd64"
308+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:arm64"
309+
echo ""
310+
echo "Multiarch manifests:"
311+
echo " - ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.base_tag }}"
312+
echo " - ${{ env.BASE_IMAGE_NAME }}:latest"
313+
echo " - ${{ env.MAIN_IMAGE_NAME }}:${{ github.event.inputs.main_tag }}"
314+
echo " - ${{ env.MAIN_IMAGE_NAME }}:latest"
315+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:${{ github.event.inputs.media_tag }}"
316+
echo " - ${{ env.MEDIA_IMAGE_NAME }}:latest"
317+
echo "=========================================="
180318
181319
# ============================================================
182320
# Summary

0 commit comments

Comments
 (0)