Open skydread1 opened 7 months ago
In entry-point, the following is used for the entrypoint:
["java" "-Dclojure.main.report=stderr" "-Dfile.encoding=UTF-8"] and the -cp and -m args are concatenated to it.
["java" "-Dclojure.main.report=stderr" "-Dfile.encoding=UTF-8"]
-cp
-m
It is common to start an app with custom JAVA_OPTS.
JAVA_OPTS
In the current implementation, the only way to do so seems to provide a custom entrypoint script such as:
entrypoint
java $JAVA_OPTS -cp ... clojure.main -m my.app.core
But providing the value of -cp is not ideal as it can be very long since jibbit does not provide a way to generate a uberjar.
uberjar
In my case I would like entry-point to look like this for instance:
entry-point
(defn entry-point [{:keys [basis aot jar-name main working-dir]}] (->> (concat ["java ${JAVA_OPTS} -Dclojure.main.report=stderr -Dfile.encoding=UTF-8"] (-> basis :argmap :jvm-opts) (if aot ["-jar" jar-name] (concat ["-cp" (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 ["sh" "-c"])))
Maybe the user could provide his own custom-entry-point in the jib config?
custom-entry-point
And in jib-build we could replace:
(.setEntrypoint (entry-point c))
by
(.setEntrypoint ((or (load-entry-point custom-entry-point) entry-point) c)) ;; with custom-entry-point the eventual custom fn provided in jib.edn for instance
Let me know if it makes sense.
Problem
In entry-point, the following is used for the entrypoint:
["java" "-Dclojure.main.report=stderr" "-Dfile.encoding=UTF-8"]
and the-cp
and-m
args are concatenated to it.It is common to start an app with custom
JAVA_OPTS
.In the current implementation, the only way to do so seems to provide a custom
entrypoint
script such as:But providing the value of -cp is not ideal as it can be very long since jibbit does not provide a way to generate a
uberjar
.Suggestion
In my case I would like
entry-point
to look like this for instance:Maybe the user could provide his own
custom-entry-point
in the jib config?And in jib-build we could replace:
by
Let me know if it makes sense.