diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c1cccc4cb..bb2e58fa5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -267,6 +267,7 @@ jobs: cwd://${{ steps.meta.outputs.bake-file }} cwd://${{ steps.meta-debug.outputs.bake-file }} set: | + base.platforms=linux/amd64 base.output=type=image,push=true base.cache-from=type=registry,ref=${{ env.BUILDCACHE }}:buildcache base.cache-to=type=registry,ref=${{ env.BUILDCACHE }}:buildcache,mode=max diff --git a/Dockerfile b/Dockerfile index ba2ed16c8..c4626351e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,7 @@ # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial # Please see LICENSE files in the repository root for full details. -# Builds a minimal image with the binary only. It is multi-arch capable, -# cross-building to aarch64 and x86_64. When cross-compiling, Docker sets two -# implicit BUILDARG: BUILDPLATFORM being the host platform and TARGETPLATFORM -# being the platform being built. +# Builds a minimal image with the binary only for amd64. # The Debian version and version name must be in sync ARG DEBIAN_VERSION=13 @@ -76,13 +73,12 @@ RUN --network=default \ cargo install --locked \ cargo-auditable@=${CARGO_AUDITABLE_VERSION} -# Install all cross-compilation targets -# Network access: to download the targets +# Install the cross-compilation target used for the image +# Network access: to download the target RUN --network=default \ rustup target add \ --toolchain "${RUSTC_VERSION}" \ - x86_64-unknown-linux-gnu \ - aarch64-unknown-linux-gnu + x86_64-unknown-linux-gnu RUN --network=none \ dpkg --add-architecture arm64 && \ @@ -90,21 +86,15 @@ RUN --network=none \ ARG BUILDPLATFORM -# Install cross-compilation toolchains for all supported targets +# Install the cross-compilation toolchain for amd64 # Network access: to install apt packages RUN --network=default \ apt-get update && apt-get install -y \ - $(if [ "${BUILDPLATFORM}" != "linux/arm64" ]; then echo "g++-aarch64-linux-gnu"; fi) \ - $(if [ "${BUILDPLATFORM}" != "linux/amd64" ]; then echo "g++-x86-64-linux-gnu"; fi) \ libc6-dev-amd64-cross \ - libc6-dev-arm64-cross \ g++ # Setup the cross-compilation environment ENV \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ - CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \ - CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ \ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc \ CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc \ CXX_x86_64_unknown_linux_gnu=x86_64-linux-gnu-g++ @@ -130,9 +120,7 @@ RUN --network=default \ --no-default-features \ --features docker \ --target x86_64-unknown-linux-gnu \ - --target aarch64-unknown-linux-gnu \ - && mv "target/x86_64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-amd64 \ - && mv "target/aarch64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli-arm64 + && mv "target/x86_64-unknown-linux-gnu/release/mas-cli" /usr/local/bin/mas-cli ####################################### ## Prepare /usr/local/share/mas-cli/ ## @@ -149,8 +137,7 @@ COPY ./translations/ /share/translations ################################## FROM gcr.io/distroless/cc-debian${DEBIAN_VERSION}:debug-nonroot AS debug -ARG TARGETARCH -COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli +COPY --from=builder /usr/local/bin/mas-cli /usr/local/bin/mas-cli COPY --from=share /share /usr/local/share/mas-cli WORKDIR / @@ -161,8 +148,7 @@ ENTRYPOINT ["/usr/local/bin/mas-cli"] ################### FROM gcr.io/distroless/cc-debian${DEBIAN_VERSION}:nonroot -ARG TARGETARCH -COPY --from=builder /usr/local/bin/mas-cli-${TARGETARCH} /usr/local/bin/mas-cli +COPY --from=builder /usr/local/bin/mas-cli /usr/local/bin/mas-cli COPY --from=share /share /usr/local/share/mas-cli WORKDIR / diff --git a/docker-bake.hcl b/docker-bake.hcl index f38e14c69..f5e191975 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -29,7 +29,6 @@ target "base" { platforms = [ "linux/amd64", - // "linux/arm64", ] }