Skip to content

Commit

Permalink
s390x: build fedora binaries for peerpod
Browse files Browse the repository at this point in the history
Fixes: confidential-containers#1640

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>
  • Loading branch information
Qi Feng Huo committed Jan 19, 2024
1 parent 0657f2c commit 35aaebf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/podvm_mkosi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ jobs:
- name: Build builder
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/s390x
tags: ghcr.io/${{ github.repository }}/podvm/builder-fedora:${{ github.sha }}
file: podvm/Dockerfile.podvm_builder.fedora
push: true

- name: Build binaries
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/s390x
tags: ghcr.io/${{ github.repository }}/podvm/binaries-fedora:${{ github.sha }}
file: podvm/Dockerfile.podvm_binaries.fedora
push: true
Expand Down
9 changes: 6 additions & 3 deletions podvm/Dockerfile.podvm_binaries.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
ARG BUILDER_IMG

FROM ${BUILDER_IMG} AS podvm_builder
FROM --platform=$TARGETPLATFORM ${BUILDER_IMG} AS podvm_builder

ARG CLOUD_PROVIDER
ARG PODVM_DISTRO=rhel
Expand All @@ -27,8 +27,11 @@ ENV ARCH ${ARCH}
ENV IMAGE_URL "none"
ENV IMAGE_CHECKSUM "none"

RUN cd cloud-api-adaptor/podvm && \
LIBC=gnu make binaries
COPY . /src/cloud-api-adaptor

WORKDIR /src/cloud-api-adaptor/podvm

RUN make binaries

FROM scratch
COPY --from=podvm_builder /src/cloud-api-adaptor/podvm/files /
52 changes: 21 additions & 31 deletions podvm/Dockerfile.podvm_builder.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,41 @@
#
# Build binaries for mkosi podvm image
#
FROM registry.fedoraproject.org/fedora:38
FROM --platform=$TARGETPLATFORM registry.fedoraproject.org/fedora:39

ARG GO_VERSION="1.20.8"
ARG ARCH="amd64"
ARG YQ_ARCH="amd64"
ARG PROTOC_ARCH="x86_64"
ARG GO_VERSION="1.20.12"
ARG PROTOC_VERSION="3.11.4"
ARG RUST_VERSION="1.72.0"
ARG YQ_VERSION="v4.35.1"
ARG YQ_CHECKSUM="sha256:bd695a6513f1196aeda17b174a15e9c351843fb1cef5f9be0af170f2dd744f08"


RUN dnf groupinstall -y 'Development Tools' && \
dnf install -y yum-utils gnupg git perl-core pkg-config libseccomp-devel gpgme-devel \
RUN dnf groupinstall -y 'Development Tools' 'Development Libraries' && \
dnf install -y yum-utils gnupg git perl perl-core pkg-config libseccomp-devel gpgme-devel \
device-mapper-devel unzip libassuan-devel \
perl-FindBin openssl-devel tpm2-tss-devel \
clang which && \
dnf clean all && \
curl -fsSLO https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm -f go${GO_VERSION}.linux-amd64.tar.gz
clang which qemu-kvm && \
dnf clean all

ADD --checksum=${YQ_CHECKSUM} https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 /usr/local/bin/yq
RUN chmod a+x /usr/local/bin/yq
ADD https://dl.google.com/go/go${GO_VERSION}.linux-${ARCH}.tar.gz go${GO_VERSION}.linux-${ARCH}.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-${ARCH}.tar.gz && rm -f go${GO_VERSION}.linux-${ARCH}.tar.gz

RUN curl -fsSL https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "${RUST_VERSION}"
ADD --checksum=${YQ_CHECKSUM} https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${YQ_ARCH} /usr/local/bin/yq
RUN chmod a+x /usr/local/bin/yq

ENV PATH "/root/.cargo/bin:/usr/local/go/bin:$PATH"

RUN echo $PATH
ADD https://sh.rustup.rs rustup
RUN chmod a+x rustup && ./rustup -y --default-toolchain ${RUST_VERSION} && \
rustup target add x86_64-unknown-linux-musl && \
ln -sf /usr/bin/g++ /bin/musl-g++ && \
rustup target add s390x-unknown-linux-gnu

RUN curl -fsSLO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local && rm -f protoc-${PROTOC_VERSION}-linux-x86_64.zip
ADD https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip
RUN unzip protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip -d /usr/local && rm -f protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip

WORKDIR /src

ARG CAA_SRC="https://github.com/confidential-containers/cloud-api-adaptor"
ARG CAA_SRC_REF="main"

ARG KATA_SRC="https://github.com/kata-containers/kata-containers"
ARG KATA_SRC_BRANCH="CCv0"

RUN echo $CAA_SRC

RUN echo $CAA_SRC_REF

RUN git clone ${CAA_SRC} -b ${CAA_SRC_REF} cloud-api-adaptor
RUN git clone ${KATA_SRC} kata-containers
RUN cd kata-containers && git checkout ${KATA_SRC_BRANCH}

ENV GOPATH /src
ENV GOPATH /src

0 comments on commit 35aaebf

Please sign in to comment.