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

arm64 arch docker image #61

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

gaganyaan2
Copy link
Contributor

  • arm64 image can be used to run on Raspberry pi, aws graviton, other cloud arm based instance and saves cost

- arm64 image can be used to run on aws graviton, Raspberry pi, other cloud arm based instance and saves cost
@KtorZ
Copy link
Member

KtorZ commented Sep 13, 2022

Hi @koolwithk, happy to give it a go but I am doubtful that would work out of the box. I don't currently have the bandwidth to get the project work on arm64, mainly because its main dependencies (i.e. cardano-node / cardano-ledger) have no desire to support arm64 as stated in some of their issues on Github.

@KtorZ KtorZ merged commit c554ae1 into CardanoSolutions:master Sep 13, 2022
@gaganyaan2
Copy link
Contributor Author

I tried with docker buildx the build and push was successful but now when i tried on the on raspberry pi arm64 it was not working with below error.

/ # kupo
/bin/kupo: line 1: syntax error: unexpected "("

After some troubleshooting I got to know it's because nixos/nix:2.3.11. This image is not available for arm64.

So I tried with nixos/nix:2.11.0 but is also failing with below error message.

#20 26.80 error: unable to load seccomp BPF program: Invalid argument
#20 26.81 (use '--show-trace' to show detailed location information)
------
Dockerfile:15
--------------------
  13 |     
  14 |     WORKDIR /app/kupo
  15 | >>> RUN nix-env -iA cachix -f https://cachix.org/api/v1/install && cachix use kupo
  16 |     COPY . .
  17 |     RUN nix-build -A kupo.components.exes.kupo -o dist
--------------------
ERROR: failed to solve: process "/bin/sh -c nix-env -iA cachix -f https://cachix.org/api/v1/install && cachix use kupo" did not complete successfully: exit code: 1
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c nix-env -iA cachix -f https://cachix.org/api/v1/install && cachix use kupo" did not complete successfully: exit code: 1

Here is failed Github CI with same error message https://github.com/koolwithk/kupo/actions/runs/3054678154/jobs/4926865360#step:11:961

After referring to NixOS/nix#5258 (comment) I'm able to bypass above error with --option filter-syscalls false in Dockerfile

RUN nix-env --option filter-syscalls false -iA cachix -f https://cachix.org/api/v1/install && cachix use kupo
RUN nix-build --option filter-syscalls false -A kupo.components.exes.kupo -o dist

However as per NixOS/nix#2651 (comment) it's an insecure method. I will take a look if there is any way to fix this.

Or We can also have separate arm64.Dockerfile for arm64 what do you think @KtorZ?

I have ran the Github CI here https://github.com/koolwithk/kupo/actions/runs/3054879616/jobs/4927301485 but build is it's taking time. Let's see how it goes.

@KtorZ
Copy link
Member

KtorZ commented Sep 14, 2022

@koolwithk thanks for giving this a closer look. Given the size of the Dockerfile and, because most of the build is in the end delegated to Nix, I think it is okay to keep a separate arm64.Dockerfile as it doesn't introduce much duplication. Let's see how your build goes 🤞

@KtorZ
Copy link
Member

KtorZ commented Sep 15, 2022

Erf, the build went over the resource limit for Github actions 😬

@gaganyaan2
Copy link
Contributor Author

qemu emulation is very slow for arm64 for obvious reason.
I see here this feature request(actions/runner-images#5631) to have arm64 image for Github Action. I can try once it's available.
Also I tried on my laptop with docker buildx but had no luck. 🙁
Now I'm building it on raspberry pi4.

@KtorZ
Copy link
Member

KtorZ commented Sep 15, 2022

I've tried building it through Nix on a Mac M1, without success. Through normal cabal though it worked fine. I can't easily produce a static binary from cabal only, but that may not be that much of a problem for a docker image. We just need to install the relevant system dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants