From 73f75d5289cb782f42b6b71b84c03b56e4833b0a Mon Sep 17 00:00:00 2001 From: LtdSauce <46743879+LtdSauce@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:23:26 +0200 Subject: [PATCH 1/2] chore(docker): ignore rust toolchain in docker builds This commit adds the known names of the rust-toolchain files to the .dockerignore file. This has two reasons why it makes sense: - The initial docker layer already has a set up rust toolchain that is sufficient to build the project. Thus, by providing a toolchain file, the toolchain would be installed again during docker build. - Currently cargo-chef only copies the toolchain files during cooking but it gets not used during the building of the dependencies in the cook call, see https://github.com/LukeMathWalker/cargo-chef/issues/271. With this in mind, currently the dependencies were actually build twice. Once with the installed toolchain from the image itself, and then in the actual cargo build call with the toolchain speciefied in the toolchain file. Building them twice resulted in timeouts when building the arm64 images as they are emulated using qemu, which is itself already slower than building natively. Now one could argue, that as soon as the mentioned issue is solved using the toolchain again would be fine. But then it would be still needed to assemble the Dockerfile in a way that the toolchain is not build twice. Because the current structure of the Dockerfile builds the toolchain once in the cargo-chef prepare step and once during the cargo build step (and would later build it during the cargo-chef cook instead of cargo build). With all this in mind using no toolchain file but instead just using the sufficient rust installation from the base image makes sense. --- .dockerignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.dockerignore b/.dockerignore index 4cf045c0ce..56eea687a2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,3 +15,9 @@ LICENSE rustfmt.toml _config.yml .lycheeignore + +# Ignore rust toolchain files as they would needlessly fetch the toolchain. +# But the image already contains a sufficient toolchain. +# Ignore both the latest naming and the legacy naming +rust-toolchain.toml +rust-toolchain From cdbada72621306e0c10f7e18d586a579bb4a45cb Mon Sep 17 00:00:00 2001 From: LtdSauce <46743879+LtdSauce@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:42:46 +0200 Subject: [PATCH 2/2] Revert "chore(docker): disable building arm64 docker images temporarily (#879)" This reverts commit cde2a8e3222f5e8f8bdd9ae841fd0e5c42f68846. Commit 73f75d5289cb782f42b6b71b84c03b56e4833b0a made it possible to build the arm64 image again without running into timeouts. --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5c3e962753..b00e6d74a3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -35,6 +35,11 @@ jobs: type=raw,value=latest type=semver,pattern={{version}} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 @@ -68,6 +73,7 @@ jobs: with: context: ./ file: ./Dockerfile + platforms: linux/amd64,linux/arm64 builder: ${{ steps.buildx.outputs.name }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }}