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 Version #195

Open
francescor opened this issue Dec 26, 2024 · 6 comments
Open

arm64 Version #195

francescor opened this issue Dec 26, 2024 · 6 comments

Comments

@francescor
Copy link

Hi @L7R7

I would like to request a release of the image for the ARM64 architecture. Currently, only the x86_64 version is available in the docker-compose you suggest, and having an ARM64 option would be incredibly helpful for us to we can move to cheaper ARM-based systems.

Btw, I've tried in my laptop the Docker build . but it fails to find the gitlab-ci-build-statuses-exe (and I don't see instructions on how to build it in the Dockerfile: I am sure missing something)

Thank you for considering this!

@L7R7
Copy link
Owner

L7R7 commented Dec 26, 2024

That's a valid request, thank you!
Building for different architectures is not something I'm deeply familiar with, but I think we can find a way that will help you. In general, I think it would be fine to build two docker images in the build pipeline: One x86_64 like the current one, and one for ARM architecture. I built a matrix build for a different tool of mine, that might work here as well.

A part of the reason why that isn't that easy is the fact that the tool is written in Haskell and cross-building on Haskell is hard (at least for me. Using nix could help, but I have no idea how that works). If you want to build the image yourself, you'd have to build the Haskell executable yourself first and then docker build . should work.
It's likely that you're not familiar with Haskell and that's okay, and I won't force you into installing the toolchain and build it yourself (if you do, I recommend GHCup for installing stack, and then stack build --copy-bins --local-bin-path . will build the executable).
What I'll definitely do is improve the documentation for how to build the tool (something like the previous paragraph should be in the readme), and I'll try to come up with a dockerfile that you can try. For that, it would be great if you could suggest a base image that would work best for you?

@francescor
Copy link
Author

francescor commented Dec 26, 2024

AI suggested the following, which I was able to build in my laptop (linux x86)

FROM haskell:9.2.5 as build-env

WORKDIR /app

COPY . .

RUN stack setup --install-ghc && \
    stack build --copy-bins --local-bin-path ./bin


FROM ubuntu:20.04
USER root
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y ca-certificates
RUN apt-get install -y libgmp-dev libgmp10
RUN apt-get install procps

RUN groupadd service
RUN mkdir /service
RUN useradd -d /service -g service service
RUN chown root:service /service && chmod 1770 /service
WORKDIR /service

COPY static /service/static

COPY --from=build-env /app/bin/gitlab-ci-build-statuses-exe /service/gitlab-ci-build-statuses-exe
RUN chmod +x /service/gitlab-ci-build-statuses-exe
EXPOSE 8282

USER service
ENTRYPOINT /service/gitlab-ci-build-statuses-exe
```

(the build was fine, but I am still not sure if the image is working)

@francescor
Copy link
Author

francescor commented Dec 26, 2024

(I'm trying two parallel separated images built, arm64 and x86, in gitlab now at https://gitlab.com/opencity-labs/gitlab-ci-build-statuses - results will be in https://gitlab.com/opencity-labs/gitlab-ci-build-statuses/-/pipelines/1603025063 )

@francescor
Copy link
Author

mmmh, nope: the build in gitlab.com reaches timeout: but I can confirm the above works if I build it in a x86 worker, and arm64 worker, too.

@L7R7
Copy link
Owner

L7R7 commented Dec 29, 2024

I think you're right, it should be possible to build the same image twice. I"ll give that a try.
The reason I didn't use a Dockerfile that also builds the executable like the variant AI suggested to you in the first place is to improve caching. AFAIR, GitHub Actions don't support caching of multi-stage builds. But in that case, I'll have to trade faster builds for improved user experience then

@francescor
Copy link
Author

thanks

once you have the arm64 version, we can test it right away

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

No branches or pull requests

2 participants