App compilation

I’m currently trying to make a docker image from Julia code. So far, I tested two approaches, making a sysimage and making an app. In either case a sysimage is created in the process. My question is: What do I need to do to ensure minimal startup time for my container? Do I rely on packages using PrecompileTools.@compile_workload? Should I add my own precompile_execution_file anyway?

Does this post help?

Yes, somewhat. I got the docker build working, also thanks to this post, and with the precompile script for PackageCompiler.jl the startup time seems reasonable. My question was what should I do on package level to ensure this?

1 Like

The most important learning for me was that for a small image you need to do a build stage and copy over only the compiled app into a slim base image - so far so common. But when you do, the compiled Julia app most likely does not work anymore because of relocatability issues. Even though the artifacts are copied into the app folder by PackageCompiler.jl. You still need to create a dummy folder .julia/artifacts and add a link from the app folder artifacts folder to .julia for it to work. It’s a shame that relocatability cannot be handled inherently by the language but is the responsibility of each and every package.

3 Likes

Feel free to make a suggestion how to improve this.

  • If it cannot be done by the language, at least the very thing that creates the app, i.e. PackageCompiler.jl could check if the product is in fact relocatable, and warn the user if not.
  • Another approach would be to make some kind of badge for a package, so that potential users see that it is or is not relocatable.
  • If it just out of laziness, the registration workflow could test it, so that there is no non-relocatable package in the general registry.