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 <[email protected]>
  • Loading branch information
Qi Feng Huo committed Jan 26, 2024
1 parent 0657f2c commit cf5d30d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 31 deletions.
4 changes: 2 additions & 2 deletions podvm-mkosi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fedora-binaries-builder:
docker buildx build \
-t fedora-binaries-builder \
--load \
- < ../podvm/Dockerfile.podvm_builder.fedora
-f ../podvm/Dockerfile.podvm_builder.fedora ../.

PHONY: binaries
binaries:
Expand All @@ -24,7 +24,7 @@ binaries:
--build-arg BUILDER_IMG=fedora-binaries-builder \
--build-arg AA_KBC=$(AA_KBC) \
-o type=local,dest="./resources/binaries-tree" \
- < ../podvm/Dockerfile.podvm_binaries.fedora
-f ../podvm/Dockerfile.podvm_binaries.fedora ../.

PHONY: image
image:
Expand Down
7 changes: 5 additions & 2 deletions podvm/Dockerfile.podvm_binaries.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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 LIBC=gnu make binaries

FROM scratch
COPY --from=podvm_builder /src/cloud-api-adaptor/podvm/files /
44 changes: 17 additions & 27 deletions podvm/Dockerfile.podvm_builder.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,39 @@
#
FROM registry.fedoraproject.org/fedora:38

ARG GO_VERSION="1.20.8"
ARG ARCH="amd64"
ARG YQ_ARCH="amd64"
# PROTOC_ARCH="x86_64" | "s390x_64"
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"
# amd64: YQ_CHECKSUM="sha256:bd695a6513f1196aeda17b174a15e9c351843fb1cef5f9be0af170f2dd744f08"
# s390x: YQ_CHECKSUM="sha256:4e6324d08630e7df733894a11830412a43703682d65a76f1fc925aac08268a45"
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 \
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 && \
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}

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
4 changes: 4 additions & 0 deletions podvm/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ $(SKOPEO_SRC):
$(call git_clone_repo_ref,$(SKOPEO_REPO),$(SKOPEO_SRC),$(SKOPEO_VERSION))

$(SKOPEO_BIN): $(SKOPEO_SRC)
ifeq ($(ARCH),s390x)
cd "$(SKOPEO_SRC)" && CC=gcc $(MAKE) bin/skopeo
else
cd "$(SKOPEO_SRC)" && CC= $(MAKE) bin/skopeo
endif

# The umoci release page only publishes amd64 binaries. https://github.com/opencontainers/umoci/releases
$(UMOCI_SRC):
Expand Down

0 comments on commit cf5d30d

Please sign in to comment.