docuum icon indicating copy to clipboard operation
docuum copied to clipboard

Support aarch64/arm64 docuum build

Open dkozlov opened this issue 3 years ago • 7 comments

Description I want to perform least recently used (LRU) eviction of Docker images on aarch64/arm64 machines. Could you please support aarch64/arm64 docuum build?

dkozlov avatar Aug 19 '21 01:08 dkozlov

HI @dkozlov, thanks for your request. I would like to support those platforms as well, especially Apple M1. The way we currently build binaries for various platforms is via GitHub-hosted runners. Unfortunately, those runners do not yet support these ARM-based architectures. Here are the tracking issues:

  • https://github.com/actions/virtual-environments/issues/2187 (Apple M1)
  • https://github.com/actions/virtual-environments/issues/2552 (arm64 Linux)

As soon as GitHub supports these, we can support them on our side too.

We could in theory support other architectures using something like QEMU, but that is not something I currently have the bandwidth to investigate.

stepchowfun avatar Aug 19 '21 05:08 stepchowfun

@dkozlov, are you on a Mac with Apple silicon by chance? If so, could you run Docuum with Rosetta 2 for now?

stepchowfun avatar Aug 20 '21 00:08 stepchowfun

@stepchowfun unfortunately I am on Ubuntu, but have some arm64 machines with docker engine.

dkozlov avatar Aug 24 '21 16:08 dkozlov

I see. I think for now unfortunately your best option is to compile Docuum yourself. Compiling it should be about as easy as installing Rust and running cargo build --release in this repo.

I expect it to work fine on arm64— if you run into any issues, I'd be happy to look into them.

stepchowfun avatar Aug 24 '21 17:08 stepchowfun

@stepchowfun, FYI:

I have managed to build arm64 docuum.

Here is Dockerfile.multiarch contents:

FROM alpine:3.12.1 as builder

RUN apk update && apk add --no-cache curl gcc musl-dev

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
        -y \
        --default-toolchain 1.55.0 \
        --profile minimal \
        --component clippy && \
      . "$HOME/.cargo/env" && \
      rustup toolchain install nightly-2021-09-08 --profile minimal --component rustfmt

WORKDIR /docuum
COPY . .
RUN . "$HOME/.cargo/env" && cargo build --release

FROM alpine:3.12.1
RUN apk add --no-cache docker-cli
COPY --from=builder /docuum/target/release/docuum /usr/bin/docuum

# Set the entrypoint to Docuum. Note that Docuum is not intended to be run as
# an init process, so be sure to pass `--init` to `docker run`.
ENTRYPOINT ["/usr/bin/docuum"]

To build amd64 and arm64 containers you need to run the following command:

docker buildx build --platform linux/amd64,linux/arm64 -t docuum-multiarch . -f Dockerfile.multiarch

dkozlov avatar Sep 28 '21 10:09 dkozlov

Thanks @dkozlov for figuring that out! I'm assuming docker buildx is using QEMU under the hood as described here.

For now I am unlikely to incorporate this into the official Docuum release flow, as this diverges a bit from how the binaries for other platforms are built (I'd really like GitHub to solve this for us), and I don't currently have the hardware or time to appropriately validate this (even if people who do have such hardware report that it works for them).

I will leave this issue open for discussion and for other people to express their desire for this architecture as well.

stepchowfun avatar Sep 30 '21 04:09 stepchowfun

Right, docker buildx is using QEMU under the hood. For GitHub Actions you can try the following approach: https://github.com/docker/setup-buildx-action

dkozlov avatar Sep 30 '21 06:09 dkozlov

Hi all, I believe this is fixed by https://github.com/stepchowfun/docuum/pull/248.

cc @dkozlov @ericparton @strowi @evanmoelter @joshsleeper

stepchowfun avatar May 23 '23 10:05 stepchowfun

awesome, thanks a ton @stepchowfun, we really appreciate it!

joshsleeper avatar May 23 '23 11:05 joshsleeper