From 681d3f3370fb9729d511f6b5cc796ec6b2abfbc3 Mon Sep 17 00:00:00 2001 From: Iker Barriocanal <32816711+iker-barriocanal@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:27:46 +0200 Subject: [PATCH] some more cleanup --- Dockerfile | 44 +++++++---------------------------- scripts/docker-build-linux.sh | 1 + 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ef4e72dc8..0abe4b4171 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ FROM centos:7 AS relay-deps ARG RUST_TOOLCHAIN_VERSION ENV RUST_TOOLCHAIN_VERSION=${RUST_TOOLCHAIN_VERSION} +ARG BUILD_ARCH + RUN yum -y update && yum clean all \ && yum -y install centos-release-scl epel-release \ # install a modern compiler toolchain @@ -19,39 +21,15 @@ RUN yum -y update && yum clean all \ && rm -rf /var/cache/yum \ && ln -s /usr/bin/cmake3 /usr/bin/cmake - -# yum -y update && yum clean all && yum -y install centos-release-scl epel-release cmake3 devtoolset-10 git llvm-toolset-7.0-clang-devel && yum clean all && rm -rf /var/cache/yum && ln -s /usr/bin/cmake3 /usr/bin/cmake - -# RUN echo 'dont cache mee' -RUN echo "build arch: ${BUILD_ARCH}" - -# RUN if [ ${BUILD_ARCH} == "aarch64" ]; then \ -RUN if true ; then \ - yum -y install git make libffi-devel curl dnf epel-release ca-certificates \ +RUN if [ ${BUILD_ARCH} == "aarch64" ]; then \ + yum -y install git make libffi-devel curl dnf ca-certificates \ && curl -L -s https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7-aarch64 > /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 \ - && cat /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 >> /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 ; \ - fi - -# yum -y install git make libffi-devel curl dnf epel-release ca-certificates && curl -L -s https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7-aarch64 > /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 && cat /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 >> /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 - -RUN echo "arch: ${BUILD_ARCH}" -# RUN if [ ${BUILD_ARCH} == "aarch64" ]; then \ -# echo "yes" ; else echo "no"; fi - -# qemu-user not found for aarch64 -# RUN if [ ${BUILD_ARCH} == "aarch64" ]; then \ -RUN if true ; then \ - yum -y install gcc glibc glibc-devel \ - # dnf --release 7 --forcearch aarch64 install gcc glibc glibc-devel \ - # && dnf --release 7 install gcc-aarch64-linux-gnu qemu-user \ - && yum -y install gcc-aarch64-linux-gnu \ - # && dnf --release 7 --forcearch aarch64 install gcc-aarch64-linux-gnu \ - # && dnf --release 7 --forcearch aarch64 install gcc-aarch64-linux-gnu qemu-user \ + && cat /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64 >> /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 \ + && yum -y install gcc glibc glibc-devel gcc-aarch64-linux-gnu \ && dnf -y --release 7 --forcearch aarch64 --installroot "/usr/aarch64-linux-gnu/sys-root/" install gcc glibc glibc-devel \ - # && dnf -y --release 7 --forcearch aarch64 --installroot "/usr/aarch64-linux-gnu/sys-root/" install gcc-aarch64-linux-gnu \ - # && dnf -y --release 7 --forcearch aarch64 --installroot "/usr/aarch64-linux-gnu/sys-root/" install gcc-aarch64-linux-gnu gcc-aarch64-linux-gnueabi gcc-aarch64-linux-gnueabihf qemu-user \ && ln -s "/usr/aarch64-linux-gnu/sys-root/lib64/libgcc_s.so.1" "/usr/aarch64-linux-gnu/sys-root/lib64/libgcc_s.so" \ - # NOTE(iker): work-around to create a cmake toolchain file for arch-specific builds, since only objcopy is needed. + # NOTE(iker): work-around to create a cmake toolchain file for arch-specific + # builds, since only objcopy is needed. && rm -rf "/usr/bin/objcopy" && ln -s "/usr/bin/aarch64-linux-gnu-objcopy" "/usr/bin/objcopy" ; \ fi @@ -64,8 +42,6 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ && echo -e '[registries.crates-io]\nprotocol = "sparse"\n[net]\ngit-fetch-with-cli = true' > $CARGO_HOME/config \ && rustup target add aarch64-unknown-linux-gnu -# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain=${RUST_TOOLCHAIN_VERSION} && echo -e '[registries.crates-io]\nprotocol = "sparse"\n[net]\ngit-fetch-with-cli = true' > $CARGO_HOME/config && rustup target add aarch64-unknown-linux-gnu - COPY --from=sentry-cli /bin/sentry-cli /bin/sentry-cli WORKDIR /work @@ -89,10 +65,6 @@ RUN : \ TARGET=${BUILD_TARGET} \ RELAY_FEATURES=${RELAY_FEATURES} -# export BUILD_TARGET="aarch64-unknown-linux-gnu" -# scl enable devtoolset-10 llvm-toolset-7.0 -- make build-linux-release TARGET=${BUILD_TARGET} RELAY_FEATURES="" -# scl enable devtoolset-10 llvm-toolset-7.0 -- cd relay && cargo build --release --locked --target=aarch64-unknown-linux-gnu - # Collect source bundle # Produces `relay-bin`, `relay-debug.zip` and `relay.src.zip` in current directory RUN : \ diff --git a/scripts/docker-build-linux.sh b/scripts/docker-build-linux.sh index 3bd604950c..6fa415d847 100755 --- a/scripts/docker-build-linux.sh +++ b/scripts/docker-build-linux.sh @@ -21,6 +21,7 @@ BUILD_IMAGE="us.gcr.io/sentryio/relay:deps" docker pull $BUILD_IMAGE || true docker buildx build \ --build-arg RUST_TOOLCHAIN_VERSION="$TOOLCHAIN" \ + --build-arg BUILD_ARCH="$BUILD_ARCH" \ --platform "linux/${DOCKER_ARCH}" \ --cache-from=${BUILD_IMAGE} \ --target relay-deps \