Skip to content

Commit d40f9f4

Browse files
committed
Build images with base image platforms
Upstream may reduce available platforms when versions reach EOL
1 parent 0ad56e6 commit d40f9f4

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/nightly.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
- run: echo '${{ needs.set-up-matrix.outputs.json }}' > versions.json
3737
- run: echo date=$(jq -r .master.date versions.json) >> $GITHUB_ENV
3838
- run: ./apply-templates.sh
39+
- run: echo base=$(ruby -e 's = File.read("master/${{ matrix.variant }}/Dockerfile"); puts s[/FROM (.*)/, 1]') >> $GITHUB_ENV
40+
- run: echo platforms=$(./architectures.rb $base) >> $GITHUB_ENV
3941

4042
- name: Set up QEMU
4143
uses: docker/setup-qemu-action@v3
@@ -58,5 +60,5 @@ jobs:
5860
with:
5961
context: ./master/${{ matrix.variant }}
6062
push: true
61-
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x
63+
platforms: ${{ env.platforms }}
6264
tags: ${{ env.tag1 }},${{ env.tag2 }}

architectures.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
3+
require "json"
4+
5+
image = ARGV[0]
6+
json = JSON.parse(`docker manifest inspect #{image}`)
7+
8+
identifiers = json["manifests"].filter_map do |manifest|
9+
platform = manifest["platform"]
10+
next unless platform["os"] == "linux"
11+
12+
optional_variant = "/#{platform['variant']}" if platform['variant']
13+
"#{platform['os']}/#{platform['architecture']}#{optional_variant}"
14+
end
15+
16+
puts identifiers.join(",")

0 commit comments

Comments
 (0)