ocurrent / solver-service

An OCluster service for solving opam dependencies
Apache License 2.0
12 stars 7 forks source link

Use dune install to add version information to executables. #48

Closed tmcgilchrist closed 1 year ago

tmcgilchrist commented 1 year ago

The previous approach using dune subst was not producing binaries with version information.

$ docker pull ocurrent/solver-service:live
$ docker image ls 
REPOSITORY                TAG       IMAGE ID       CREATED         SIZE
ocurrent/solver-service   live      eba01b2690c8   14 hours ago    567MB
$ docker run -it --entrypoint /bin/bash eba01b2690c8
root@07bfc220368b:/var/lib/ocluster-worker# /usr/local/bin/solver-worker --version
n/a

I suspect the copying hack we have for depending on solver-service might be responsible. But I've not debugged into the dune source code for what is going on exactly.

Using dune install reliably produces a binary with version information.

$ docker build -t solver-service -f Dockerfile .
$ docker image ls
REPOSITORY                TAG       IMAGE ID       CREATED          SIZE
solver-service            latest    0fb0e2680187   13 minutes ago   567MB
$ docker run -it --entrypoint /bin/bash 0fb0e2680187
root@b14fe72206fb:/var/lib/ocluster-worker# /usr/local/bin/solver-worker --version
83cf768-dirty

Based off the discussion here https://github.com/ocurrent/ocluster/pull/178 and @MisterDA 's suggestion

tmcgilchrist commented 1 year ago

The solver worker forks a solver service process and communicates to it over CapnP. So we need both executables in the docker image.