Fork me on GitHub
Carsten Behring12:09:26

I use the docker pod like this:

(require '[babashka.pods :as pods])
(require '[ :refer [sh]])
(require '( [io :as io]))

(pods/load-pod 'lispyclouds/docker "0.1.1")
(require '[pod.lispyclouds.docker :as docker])

(def images (docker/client {:category :images
                            :conn     {:uri "unix:///var/run/docker.sock"}}))

(shell/sh "tar cf /tmp/context.tar .")

(def is (io/input-stream "/tmp/context.tar"))
(docker/invoke images {:op :ImageBuild
                       :inputStream is
                       :dockerfile "Dockerfile"})
To do a

Carsten Behring12:09:29

But I get a error message which I don't understand, and seem to be related to babashka

clojure.lang.ExceptionInfo: No reader function for tag object
{:type :sci/error, :line 1, :column 1, :message "No reader function for tag object", :sci.impl/callstack #object[clojure.lang.Delay 0x5b73dbd7 {:status :pending, :val nil}], :file "/home/carsten/Dropbox/sources/scicloj-tooling/", :locals {}}
 at sci.impl.utils$rethrow_with_location_of_node.invokeStatic (utils.cljc:71)
    sci.impl.evaluator$eval.invokeStatic (evaluator.cljc:329)
    sci.impl.interpreter$eval_form.invokeStatic (interpreter.cljc:78)
    sci.core$eval_form.invokeStatic (core.cljc:270)
    babashka.nrepl.impl.server$eval_msg$fn__34566$fn__34567.invoke (server.clj:61)
    babashka.nrepl.impl.server$eval_msg$fn__34566.invoke (server.clj:57)
    babashka.nrepl.impl.server$eval_msg.invokeStatic (server.clj:47)
    babashka.nrepl.impl.server$session_loop.invokeStatic (server.clj:242)
    babashka.nrepl.impl.server$listen$fn__34639.invoke (server.clj:283)
    sci.impl.vars$binding_conveyor_fn$fn__700.invoke (vars.cljc:154)
    clojure.core$binding_conveyor_fn$fn__5773.invoke (core.clj:2034)


@U7CAHM72M Ah I see. You cannot push the input stream over the wire to the pod function call. Pod functions work via RPC and you can't serialize an inputstream via edn or transit


Perhaps @rahul080327, the author of this pod, knows a better alternative


Is it possible to just pass a :file or so?


This unfortunately is a requirement of the docker API and hence the lib that i wrote too. Probably in this case its better to shell out to the docker cli and do the build as i can see the docker daemon locally running


(shell/sh "docker build .")

👍 2

@rahul080327 you could serialize the :inputstream argument to a byte array though and then make it an inputsteam again on the pod side. This is just work that comes with pod making.


I've done similar things with the sql pods


it's using transit which makes this a lot easier


yeah i can think about it sometime soon, probably can use the newer lib for the pod


the contajners one?


new pod in fact


This needs to be shared here. Calling native libraries from bb: /cc @suskeyhose @rahul080327

Joshua Suskalo22:09:32

is libffi a graal library?


graalvm has a c ffi, but you can't load and call c libraries dynamically,

Joshua Suskalo21:09:05

ah, I see. that makes sense.