Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
run.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
open Lwt.Infix type t = { pool : unit Current.Pool.t option; } let id = "docker-run" module Key = struct type t = { image : Image.t; args : string list; docker_context : string option; run_args : string list; } let pp_args = Fmt.(list ~sep:sp (quote string)) let cmd { image; args; docker_context; run_args } = Cmd.docker ~docker_context @@ ["run"] @ run_args @ ["--rm"; "-i"; Image.hash image] @ args let pp f t = Cmd.pp f (cmd t) let digest { image; args; docker_context; run_args } = Yojson.Safe.to_string @@ `Assoc [ "image", `String (Image.hash image); "args", [%derive.to_yojson:string list] args; "docker_context", [%derive.to_yojson:string option] docker_context; "run_args", [%derive.to_yojson:string list] run_args; ] end module Value = Current.Unit let build { pool } job key = Current.Job.start job ?pool ~level:Current.Level.Average >>= fun () -> Current.Process.exec ~cancellable:true ~job (Key.cmd key) let pp = Key.pp let auto_cancel = true