Doesn't work in alpine docker container #346
Comments
@jfrolich are executables built on alpine compatible with other distributions and not the other way around?
|
Feel free to send a PR and we can test it. |
Yes I believe you can just use an alpine container, and then it also works on other distributions. |
It requires building on alpine and using static linking. I figured it out thanks to @anmonteiro help |
Is there an example of doing that on Azure? |
I'm not sure. I'm using I'm also using custom docker container with esy preinstalled on alpine: I'm not familiar with how genType release pipeline works. I hope it will help. |
Sorry I indeed found out that genType was not already using docker. So this is probably not an easy PR. Not sure if this is already tackled in https://github.com/jchavarri/hello-ppx-esy, but that repo is a great PPX starter with CI etc. set up. It might make sense to adopt this standard tooling so every improvement to that is easy to pull in to individual ppx-es. (Just an idea). |
@jfrolich probably a good idea to continue the discussion on discord in the |
Btw genType produces a single binary and has zero dependencies, so a quick workaround is to just build from source, while a CI solution is investigated. |
It seems there is a fix which doesn't require RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk && \
apk add glibc-2.25-r0.apk It slightly increases image size but works with the current version of |
@baransu thanks for the reference. |
Actually, I might have misunderstood the point. Are you saying that it's not necessary to make an alpine build at all? |
Probably yes. I've added the above snippet and created a custom docker image based on alpine with that line. Now |
Yeah, that fixes it because the dynamic dependency on glibc (which is quite big). To make a static binary you can compile it with musl-libc. Then it will work everywhere, even on systems that do not have glibc (like small docker images). To do that you can install musl on the CI and add a compiler flag: |
I'm still in the camp of shipping a fully static binary, given that there are Linux distributions that are explicitly no FHS compliant. NixOS is the example I use. |
@anmonteiro if we find a general way to do this for esy projects, we can reuse it. |
it should be straightforward to install |
Closing for now. |
+1 for statically linked binary. Facing the same issue on NixOS. |
Is this related to |
What would this look like in a |
The project has moved inside the upcoming v10.1 compiler. No need to install genType separately in future. |
The project page will change once v10.1 is out and used regularly. |
Graphq_ppx_re had the same problem:
teamwalnut/graphql-ppx#44
teamwalnut/graphql-ppx#60
The text was updated successfully, but these errors were encountered: