Skip to content

Conversation

skydread1
Copy link

Closes #23

changes

  • add a load-var util function to resolve a given symbol
  • rename core/entry-point to core/default-entry-point for clarity
  • allows a user to provide :entry-point symbol in the jib config with his own implementation of entry-point.

Example of use case

For example, a project might want to have some env var passed down and a specify the shell like so:

(ns jibbit
  (:require [jibbit.core :as jibbit]))

(defn my-entry-point
  [{:keys [basis main working-dir]}]
  (->> (concat
        ["java ${JAVA_OPTS} -Dclojure.main.report=stderr -Dfile.encoding=UTF-8"]
        (concat
         ["-cp" (jibbit/container-cp basis working-dir) "clojure.main"]
         (if-let [main-opts (-> basis :argmap :main-opts)]
           main-opts
           ["-m" (pr-str main)])))
       (interpose " ")
       (apply str)
       (conj ["/bin/sh" "-c"])))

Then, this implementation can be specified in the jib.edn for instance:

{:main         my.app.core
 :user         "root"
 :group        "root"
 :base-image   {:image-name "openjdk:11-slim-buster"
                :type       :registry}
 :target-image {:image-name "props-reco/test"
                :type       :docker
                :tag "test"}
 :entry-point jibbit/my.entry-point}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There is no way to provide $JAVA_OPTS in the default entrypoint
1 participant