Skip to content

Commit fe46a07

Browse files
author
Oleg Bulatov
authored
Merge pull request #7 from jcho02/main
ppc64le support for quay-builder-qemu
2 parents c51063d + 8dba0e3 commit fe46a07

File tree

2 files changed

+67
-22
lines changed

2 files changed

+67
-22
lines changed

.github/workflows/build-and-publish.yaml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,57 @@ jobs:
4242
- name: Set up Docker Buildx
4343
uses: docker/setup-buildx-action@v2
4444

45-
- name: Build and push
45+
- name: Build container for amd64
4646
id: docker_build
47-
uses: docker/build-push-action@v2
47+
uses: docker/build-push-action@v3
4848
env:
49-
TAG: ${{ steps.version-from-branch.outputs.version }}${{ env.TAG_SUFFIX }}
49+
TAG: amd64
50+
with:
51+
platforms: linux/amd64
52+
build-args: |
53+
channel=stable
54+
image=quay.io/centos/centos:stream9
55+
push: true
56+
file: Dockerfile
57+
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-${{ env.TAG }}
58+
provenance: false
59+
60+
- name: Build and push s390x
61+
id: docker_build_s390x
62+
uses: docker/build-push-action@v3
63+
env:
64+
TAG: s390x
65+
with:
66+
platforms: linux/s390x
67+
build-args: |
68+
channel=stable
69+
image=quay.io/centos/centos:stream9
70+
push: true
71+
file: Dockerfile
72+
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-${{ env.TAG }}
73+
provenance: false
74+
75+
- name: Build and push ppc64le
76+
id: docker_build_ppc64le
77+
uses: docker/build-push-action@v3
78+
env:
79+
TAG: ppc64le
5080
with:
51-
platforms: linux/amd64, linux/s390x
52-
build-args: channel=stable
81+
platforms: linux/ppc64le
82+
build-args: |
83+
channel=stable
84+
image=quay.io/centos/centos:stream8
5385
push: true
5486
file: Dockerfile
55-
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag || env.TAG }}
87+
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-${{ env.TAG }}
88+
provenance: false
89+
90+
- name: Build and push multi-arch manifest
91+
uses: Noelware/docker-manifest-action@master
92+
env:
93+
TAG: ${{ steps.version-from-branch.outputs.version }}${{ env.TAG_SUFFIX }}
94+
with:
95+
inputs: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag || env.TAG }}
96+
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-amd64,${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-s390x,${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag }}-ppc64le
97+
push: true
98+
amend: true

Dockerfile

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
FROM quay.io/centos/centos:stream9 as base
1+
ARG image="quay.io/centos/centos:stream9"
2+
FROM ${image} as base
23
ARG channel="stable"
34
ARG location
45

56
RUN [ -z "${channel}" ] && echo "ARG channel is required" && exit 1 || true
67

78
RUN yum -y install jq xz
89
RUN ARCH=$(uname -m) ; echo $ARCH \
9-
; curl https://builds.coreos.fedoraproject.org/streams/${channel}.json -o stable.json && \
10-
cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.release'
10+
; curl https://builds.coreos.fedoraproject.org/streams/${channel}.json -o stable.json && \
11+
cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.release'
1112

1213

1314
FROM base AS executor-img
1415

15-
RUN if [[ -z "$arg" ]] ; then \
16-
ARCH=$(uname -m) ; echo $ARCH ; \
17-
echo "Downloading" $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
18-
curl -s -o coreos_production_qemu_image.qcow2.xz $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
19-
unxz coreos_production_qemu_image.qcow2.xz ; \
20-
else \
21-
echo "Downloading" ${location} && \
22-
curl -s -o coreos_production_qemu_image.qcow2.xz ${location} && unxz coreos_production_qemu_image.qcow2.xz \
23-
; fi
24-
16+
RUN ARCH=$(uname -m) ; echo $ARCH ; \
17+
if [[ $ARCH == "ppc64le" ]] ; then \
18+
echo "Downloading https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/36.20220906.3.1/ppc64le/fedora-coreos-36.20220906.3.1-qemu.ppc64le.qcow2.xz" && \
19+
curl -s -o coreos_production_qemu_image.qcow2.xz https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/36.20220906.3.1/ppc64le/fedora-coreos-36.20220906.3.1-qemu.ppc64le.qcow2.xz && \
20+
unxz coreos_production_qemu_image.qcow2.xz ; \
21+
else \
22+
echo $ARCH && \
23+
echo "Downloading" $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
24+
curl -s -o coreos_production_qemu_image.qcow2.xz $(cat stable.json | jq -r --arg arch "$ARCH" '.architectures[$arch].artifacts.qemu.formats."qcow2.xz".disk.location') && \
25+
unxz coreos_production_qemu_image.qcow2.xz \
26+
; fi
2527

2628
FROM base AS final
2729
ARG channel=stable
@@ -30,9 +32,9 @@ RUN mkdir -p /userdata
3032
WORKDIR /userdata
3133

3234
RUN yum -y update && \
33-
yum -y remove jq && \
34-
yum -y install openssh-clients qemu-kvm && \
35-
yum -y clean all
35+
yum -y remove jq && \
36+
yum -y install openssh-clients qemu-kvm && \
37+
yum -y clean all
3638

3739
COPY --from=executor-img /coreos_production_qemu_image.qcow2 /userdata/coreos_production_qemu_image.qcow2
3840
COPY start.sh /userdata/start.sh

0 commit comments

Comments
 (0)