From cd828c44fe587dbf1fce484026d438635d844b31 Mon Sep 17 00:00:00 2001 From: Qi Feng Huo Date: Fri, 15 Sep 2023 17:55:17 +0800 Subject: [PATCH] peerpod-ctl: fix libvirt-libs for multi-arch images for peerpod-ctl Fixes: #1432 Signed-off-by: Qi Feng Huo --- .github/workflows/peerpod-ctrl_image.yaml | 1 + peerpod-ctrl/Dockerfile | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/peerpod-ctrl_image.yaml b/.github/workflows/peerpod-ctrl_image.yaml index 8f480b4f58..889bcec39a 100644 --- a/.github/workflows/peerpod-ctrl_image.yaml +++ b/.github/workflows/peerpod-ctrl_image.yaml @@ -9,6 +9,7 @@ on: push: branches: - main + - huoqifeng/peerpod-ctl-img paths: - 'peerpod-ctrl/**' diff --git a/peerpod-ctrl/Dockerfile b/peerpod-ctrl/Dockerfile index b8e32f8731..12f5c82725 100644 --- a/peerpod-ctrl/Dockerfile +++ b/peerpod-ctrl/Dockerfile @@ -27,8 +27,11 @@ COPY controllers/ controllers/ # CC=gcc because the cgo compiler will always be gcc in image golang-fedora, even for s390x and ppc64le RUN CC=gcc CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build ${GOFLAGS} -a -o manager main.go +# Target Image FROM --platform=$TARGETPLATFORM fedora:36 -RUN if [ "$CGO_ENABLED" = 1 ] ; then dnf install -y libvirt-libs /usr/bin/ssh && dnf clean all; fi +ARG CGO_ENABLED=1 + +RUN if [ "$CGO_ENABLED" = 1 ] ; then dnf install -y libvirt-libs && dnf clean all; fi WORKDIR / COPY --from=builder /workspace/manager .