Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux/Darwin arm64 cross-compiling support for x86_64 Docker image #14

Merged
merged 9 commits into from
Oct 4, 2022

Conversation

joseluisq
Copy link
Owner

@joseluisq joseluisq commented Oct 3, 2022

Continuing the work done on #13. This PR adds support for cross-compiling Linux/Darwin arm64 apps from a x86_64 Docker image.
It also improves Dockerfile layers caching and cross-compilation tests.

markmandel and others added 7 commits September 30, 2022 14:23
This PR updates the Docker image such that it can be
successfully built and used as either a linux/amd64 image
or a linux/amd64 image.

The Makefile has been given a new `buildx` command to utilise
Docker's multi-platorm building capability to build and push (!!!)
both images.

This is separate from the `build` command as since one of the arch's
will be compiled under emulation, and therefore `buildx` can take a
long time to complete (took ~2h on my 8 core old gaming laptop).

Some other things added along the way:

* Makefile take REPOSITORY and TAG arguments, such that
  building local images and testing is easier to do.

Out of scope:

* Haven't integrated it with GitHub actions, as I'm not that
  familiar with it, but figured this was a good first step.

Known issues:

* For arm64 images, can't get linux-musl test in `make test` to pass.
  Wondering if we need to explicitly install the amd64 version via apt?
  Have yet to experiment. Cross compiling to `x86_64-apple-darwin`
  works perfectly though on arm64 host.

Work on #12
- linux gcc: gcc-aarch64-linux-gnu
- rust toolchain: aarch64-unknown-linux-gnu
- rust toolchain: aarch64-unknown-linux-musl
@joseluisq joseluisq added enhancement New feature or request arm64 x86_64 labels Oct 3, 2022
@joseluisq joseluisq self-assigned this Oct 3, 2022
@joseluisq joseluisq changed the title Linux/Darwin arm64 cross-compiling support from x86_64 Linux/Darwin arm64 cross-compiling support for x86_64 Docker image Oct 3, 2022
@joseluisq joseluisq force-pushed the dockerfile-refactoring branch from 1cd2c43 to 60fe50d Compare October 3, 2022 23:19
@joseluisq joseluisq force-pushed the dockerfile-refactoring branch from 60fe50d to 28d67a7 Compare October 3, 2022 23:21
@joseluisq joseluisq merged commit 2b82c30 into master Oct 4, 2022
@joseluisq joseluisq deleted the dockerfile-refactoring branch October 4, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm64 enhancement New feature or request x86_64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants