Hi David, It helps a bit. But my biggest problem is that the Ocaml application (main.exe in your example) has dependencies to other Ocaml libraries built using OPAM. I need to find a way to find those dependencies and make sure that the paths are resolved correctly once libraries have have been copied to the image. -- Hans Ole On Thu, Mar 29, 2018 at 8:13 PM, David Scott wrote: > Hi, > > I had a quick go at creating something with Docker: (and alpine since I > was more familiar with it, but I suspect a similar technique would work > with ubuntu) > > https://github.com/djs55/experiments/pull/1 > > It uses `opam` to build a simple OCaml example (taken from cryptokit) > which needs `libgmp` at runtime. The `Dockerfile` has a slightly hacky > attempt to detect the runtime dependency: > > opam depext -n cryptokit | grep -v '#' | grep '\-dev' | while read in; do > basename "$in" -dev; done > needed-packages.txt > > It assumes that > > - all external C libraries have an alpine depext called foo-dev > - foo-dev has a corresponding runtime package called foo > > and installs these `foo` in an output minimal alpine image (i.e. one > without the development tools or other unnecessary stuff) > > Another approach would be to use `ldd` or `objdump` recursively to find > libraries and copy only those binaries into the output (possibly using > `FROM scratch`?) > > I don't know if this will help -- I realise my test case is a bit minimal > :-) > > Cheers, > Dave > > > On Thu, Mar 29, 2018 at 5:31 PM, Hans Ole Rafaelsen > wrote: > >> Hi, >> >> I have small application written using Ocsigen. Ocaml and the rest of the >> development environment is installed using OPAM. >> >> Now I want to install this application on a few other nodes, without >> having to bring bring along the whole development process for deployment on >> each node. What I want to end up with, is a single unit, e.g a tar-file, a >> docker container or similar, that can be copied and deployed to the target >> nodes. This unit should only contain the binaries needed to run the >> application. >> >> I have tried to ask on the Ocsigen mailing-list how do do this for >> Ocsigen applications, but without success. But I guess the problem is more >> related to how to deploy applications built using OPAM. I did not find any >> way to do this with OPAM, but I might have missed something. I have tried >> to copy all the binary files (.so, .cmxa .cmxs, etc) from the OPAM >> directory and setting the environment variables to point the this new >> location, but without much success. When starting ocsigenserver it was not >> able to solve all symbols. Looking more into the problem, it looks like >> binaries such as ocsigenserver has hard coded the location of the OPAM >> development environment. Might be possible to override this using >> environment variables, but I'm not sure how. So I gave up on this track. >> >> >> Is there a way to generate such a deployable unit from OPAM development >> environment? >> >> Do anyone have some tips / best practice on how to deploy applications >> built using OPAM? >> >> (I'm developing and want to deploy on Ubuntu 16.04.) >> >> Regards, >> >> Hans Ole Rafaelsen >> > > > > -- > Dave Scott > -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs