Closed abhiyaantrix closed 3 years ago
I had the same problem. I think is was due to, that alpine uses musl instead of glib. This resulted into a complete recompilation of ninja and the ocaml toolchain. After I got it to work, the resulting image was about 1.5GB. If you only use alpine to reduce the image size, I recommend you to use node:slime image. Initially it will be a bit bigger then alpine... but a lot less headache and smaller then the alpine image with the recompiled rescript toolchain.
Shameless plug: I did myself create a docker based dev environment ~here~ here. :) It uses rescript-zora for unit testing and vite for bundling and live preview. Via docker-compose you can start various services to recompile rescript files, run automatic unit-tests and reload website on source changes.
the ocaml toolchain. After I got it to work, the resulting image was about 1.5GB.
The ocaml toolchain can be removed after installation. @GlancingMind do you also need musl for ocaml toolchain to work on alpine linux properly?
@GlancingMind thanks for the insights. Makes sense. Switched to slim to avoid recompiling ninja.
Though now I have yet another issue and need to deal with that separately. Dockerizing a simple application, how hard that could be ;-)
The ocaml toolchain can be removed after installation.
@bobzhang I tried via multi stage build, but I had some other difficulties. After I noticed that node:slime works out of the box, I concluded forcing myself into alpine isn't worth the trouble (for this time ;-) ). Especially as I can build and bundle with node:slime and then copy it over to node:alpine via multistage build (if container result size matters that much).
@GlancingMind do you also need musl for ocaml toolchain to work on alpine linux properly?
I don't know. I think I just installed the dependencies that where required to compile ninja. Then everything compiled successfully. So possible that my above given explanation is wrong.
I think it was due to, that alpine uses musl instead of glib.
Unfortunately I also no longer have this code. :(
@GlancingMind thanks for the insights. Makes sense. Switched to slim to avoid recompiling ninja.
@abhiyaantrix Glad it helped. :)
Though now I have yet another issue and need to deal with that separately. Dockerizing a simple application, how hard that could be ;-)
@abhiyaantrix Cannot help you with this one. I'm very new to Rescript myself (nor do I know OCaml and ReasonML).
So take my following words with a grain of salt ;-). I think your code seem to use some ppx
. As much as I know about them (out of the Rescript forum) is, that these are not officially supported.
I don't know. I think I just installed the dependencies that where required to compile ninja. Then everything compiled successfully.
Good to know, what are essential tools to compile ninja?
@GlancingMind to clarify a little bit about ppx. PPX is essentially a compiler plugin using ReScript compiler API (which is unstable ). We supported it and in retrospect it is a mistake as you can see you will come across weird issues like this. So try to avoid any use of ppx in your dependencies if you can.
Good to know, what are essential tools to compile ninja?
python, g++ and make
Here is a repository with a minimal Dockerfile. The resulting image is 1.6GB in size.
so this issue is resolved?
For me it is solved, but @abhiyaantrix uses "bs-platform": "8.3.3" while I only compiled the latest rescript version. So better get @abhiyaantrix feedback too.
I successfully compiled bs-platform "8.3.3" with python3 on an node:12-alpine3.10 image. Note that the repo still has "^8.3.3" as bsb version, but I successfully compiled "8.3.3" locally. So I cannot reproduce @abhiyaantrix compilation error with the minimal dependencies required to compile bs-platform.
closed as it seems work when you have python and build-essentials installed. we welcome patches to get rid of python for building ninja
While trying to Dockerize another OS project, I faced some issues. Please note ReScript, ninja are all new things for me. For now, I am only trying to create a Docker-based development environment for this project.
Using docker image
node:12-alpine3.10
Error log
Part of Package.json
Rudimentary Dockerfile to reproduce this