Skeleton projects for deploying R/Shiny apps that call Julia code via Docker. Two approaches are provided:
sysimage/ — JuliaCall + Sysimage
Uses the JuliaCall R package with a precompiled sysimage for faster startup. Julia is installed in the Docker image at runtime.
- Pro: Simple R integration via
julia_call() - Con: Requires Julia installation in the Docker image (~1.5GB overhead)
cd sysimage
docker build -t myapp-sysimage .
docker run -d -p 4444:3838 myapp-sysimagesharedlib/ — Compiled Shared Library
Compiles Julia code into a shared library (libmyjulia.so) via PackageCompiler.create_library. R calls Julia functions directly via .C() — no JuliaCall, no Julia installation in the runtime image.
- Pro: Smaller image, no runtime Julia dependency, faster cold start
- Con: Requires C shim for ABI bridging, more build setup
cd sharedlib
docker build -t myapp-sharedlib .
docker run -d -p 4444:3838 myapp-sharedlibBoth approaches call the same Julia function (mymean) from R/Shiny:
| Sysimage | Shared Library | |
|---|---|---|
| R calls Julia via | julia_call("myjulia.mymean", data) |
.C("c_mymean", data, n, result) |
| Julia compiled as | Sysimage (.so loaded by JuliaCall) |
Shared library (.so loaded by dyn.load) |
| Docker stages | 1 (Julia installed in image) | 2 (builder compiles, runtime is lean) |
| Needs JuliaCall | Yes | No |
| Needs Julia in runtime | Yes | No |