Skip to content

Commit 0ba17b4

Browse files
authored
ci: switch to docker buildx (rh-ecosystem-edge#1045)
The existing buildah actions seem to be unmaintained and are now failing. This commit switches to using the docker versions since they should work as expected and be better maintained. Additionally, the dockerfile has been updated to use a multi-stage build and extract Go using the native platform. Finally, the go version in the Dockerfile now matches go.mod.
1 parent f98aa02 commit 0ba17b4

File tree

3 files changed

+56
-73
lines changed

3 files changed

+56
-73
lines changed

.github/workflows/docker-image-ci.yml

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,19 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v6
2020

21+
- name: Login to Quay.io
22+
uses: docker/login-action@v3
23+
with:
24+
registry: quay.io
25+
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
26+
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
27+
2128
- name: Set up QEMU
2229
uses: docker/setup-qemu-action@v3
2330

31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
2434
- name: Set image tag
2535
shell: bash
2636
run: |
@@ -33,55 +43,20 @@ jobs:
3343
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_OUTPUT
3444
id: set_image_tag
3545

36-
- name: Build docker image
37-
id: build-image
38-
uses: redhat-actions/buildah-build@v2
39-
with:
40-
image: eco-gotests
41-
tags: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
42-
containerfiles: |
43-
./Dockerfile
44-
archs: amd64, arm64
45-
46-
- name: Push To quay.io
47-
id: push-to-quay
48-
uses: redhat-actions/push-to-registry@v2
49-
with:
50-
image: ${{ steps.build-image.outputs.image }}
51-
tags: ${{ steps.build-image.outputs.tags }}
52-
registry: quay.io/ocp-edge-qe
53-
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
54-
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
55-
56-
- name: Print image url
57-
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
58-
59-
- name: Log in to Registry
60-
uses: redhat-actions/podman-login@v1
61-
with:
62-
registry: quay.io/ocp-edge-qe/eco-gotests
63-
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
64-
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
65-
66-
- name: Build docker eco-gotests-ran-du image
67-
id: build-image-system
68-
uses: redhat-actions/buildah-build@v2
46+
- name: Build and push eco-gotests
47+
uses: docker/build-push-action@v6
6948
with:
70-
image: eco-gotests-ran-du
71-
tags: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
72-
containerfiles: |
73-
./images/system-tests/ran-du/Dockerfile
74-
archs: amd64, arm64
75-
76-
- name: Push To quay.io eco-gotests-ran-du image
77-
id: push-to-quay-eco-gotests-ran-du
78-
uses: redhat-actions/push-to-registry@v2
49+
context: .
50+
file: ./Dockerfile
51+
push: true
52+
platforms: linux/amd64,linux/arm64
53+
tags: quay.io/ocp-edge-qe/eco-gotests:${{ steps.set_image_tag.outputs.IMAGE_TAG }}
54+
55+
- name: Build and push eco-gotests-ran-du
56+
uses: docker/build-push-action@v6
7957
with:
80-
image: ${{ steps.build-image-system.outputs.image }}
81-
tags: ${{ steps.build-image-system.outputs.tags }}
82-
registry: quay.io/ocp-edge-qe
83-
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
84-
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
85-
86-
- name: Print image url eco-gotests-ran-du
87-
run: echo "Image pushed to ${{ steps.push-to-quay-eco-gotests-ran-du.outputs.registry-paths }}"
58+
context: .
59+
file: ./images/system-tests/ran-du/Dockerfile
60+
push: true
61+
platforms: linux/amd64,linux/arm64
62+
tags: quay.io/ocp-edge-qe/eco-gotests-ran-du:${{ steps.set_image_tag.outputs.IMAGE_TAG }}

.github/workflows/docker-image-manual.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,24 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v6
1818

19+
- name: Login to Quay.io
20+
uses: docker/login-action@v3
21+
with:
22+
registry: quay.io
23+
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
24+
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
25+
1926
- name: Set up QEMU
2027
uses: docker/setup-qemu-action@v3
2128

22-
- name: Build docker image
23-
id: build-image
24-
uses: redhat-actions/buildah-build@v2
25-
with:
26-
image: eco-gotests
27-
tags: ${{ github.event.inputs.tag }}-unstable
28-
containerfiles: |
29-
./Dockerfile
30-
archs: amd64, arm64
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
3131

32-
- name: Push To quay.io
33-
id: push-to-quay
34-
uses: redhat-actions/push-to-registry@v2
32+
- name: Build and push
33+
uses: docker/build-push-action@v6
3534
with:
36-
image: ${{ steps.build-image.outputs.image }}
37-
tags: ${{ steps.build-image.outputs.tags }}
38-
registry: quay.io/ocp-edge-qe
39-
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
40-
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
41-
42-
- name: Print image url
43-
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
35+
context: .
36+
file: ./Dockerfile
37+
push: true
38+
platforms: linux/amd64,linux/arm64
39+
tags: quay.io/ocp-edge-qe/eco-gotests:${{ github.event.inputs.tag }}-unstable

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:latest AS fetcher
2+
3+
ARG GO_VER=go1.25.4
4+
RUN dnf install -y tar
5+
6+
ARG TARGETARCH
7+
RUN arch=$(echo ${TARGETARCH} | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
8+
curl -Ls https://go.dev/dl/${GO_VER}.linux-${arch}.tar.gz | tar -C /usr/local -xzf -
9+
110
FROM registry.access.redhat.com/ubi9/ubi:latest
211

3-
ARG GO_VER=go1.25.0
12+
# We had issues with extracting the Go tarball using emulation, so this way we
13+
# extract it natively and then copy to the final image with the target
14+
# architecture.
15+
COPY --from=fetcher /usr/local/go /usr/local/go
16+
17+
ARG GO_VER=go1.25.4
418
519
ARG CONTAINERUSER=testuser
620

@@ -12,8 +26,6 @@ LABEL container.user=${CONTAINERUSER}
1226
ENV PATH "$PATH:/usr/local/go/bin:/root/go/bin"
1327
RUN dnf install -y tar gcc make && \
1428
dnf clean metadata packages && \
15-
arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
16-
curl -Ls https://go.dev/dl/${GO_VER}.linux-${arch}.tar.gz |tar -C /usr/local -xzf - && \
1729
useradd -U -u 1000 -m -d /home/${CONTAINERUSER} -s /usr/bin/bash ${CONTAINERUSER}
1830

1931
USER ${CONTAINERUSER}

0 commit comments

Comments
 (0)