Skip to content

Commit ee8455f

Browse files
authored
Merge pull request #48 from tmcgilchrist/really_version
Use dune install to add version information to executables.
2 parents 9087a91 + 83cf768 commit ee8455f

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ RUN opam pin add -yn current_docker.dev "./ocurrent" && \
3636

3737
RUN opam install -y --deps-only .
3838
ADD --chown=opam . .
39-
RUN opam exec -- dune subst
40-
RUN opam exec -- dune build ./_build/install/default/bin/solver-service
41-
RUN opam exec -- dune build ./_build/install/default/bin/solver-worker
39+
RUN opam config exec -- dune build -p solver-service,solver-service-api,solver-worker @install
40+
RUN opam config exec -- dune install --prefix=/usr/local --destdir=pkg --section=bin --relocatable solver-worker solver-service
4241

4342
FROM ubuntu:22.04
4443
RUN apt-get update && apt-get install docker.io libev4 curl gnupg2 git libsqlite3-dev ca-certificates netbase -y --no-install-recommends
4544
WORKDIR /var/lib/ocluster-worker
4645
ENTRYPOINT ["/usr/local/bin/solver-worker"]
4746
ENV PROGRESS_NO_TRUNC=1
48-
COPY --from=build /src/_build/install/default/bin/solver-worker /src/_build/install/default/bin/solver-service /usr/local/bin/
47+
COPY --from=build \
48+
/src/pkg/usr/local/bin/solver-worker \
49+
/src/pkg/usr/local/bin/solver-service \
50+
/usr/local/bin/

service/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
capnp-rpc-unix
1212
git-unix
1313
ocaml-version
14+
dune-build-info
1415
str
1516
fmt.cli
1617
fmt.tty)

service/main.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,14 @@ let sockpath =
149149
will use stdin."
150150
~docv:"SOCKPATH" [ "sockpath" ]
151151

152+
let version =
153+
match Build_info.V1.version () with
154+
| None -> "n/a"
155+
| Some v -> Build_info.V1.Version.to_string v
156+
152157
let cmd =
153158
let doc = "Solver for ocaml-ci" in
154-
let info = Cmd.info "solver-service" ~doc in
159+
let info = Cmd.info "solver-service" ~doc ~version in
155160
Cmd.v info
156161
Term.(
157162
const main

0 commit comments

Comments
 (0)