Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to provide $JAVA_OPTS in the default entrypoint #23

Open
skydread1 opened this issue Apr 16, 2024 · 0 comments · May be fixed by #24
Open

There is no way to provide $JAVA_OPTS in the default entrypoint #23

skydread1 opened this issue Apr 16, 2024 · 0 comments · May be fixed by #24

Comments

@skydread1
Copy link

skydread1 commented Apr 16, 2024

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:

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.

Suggestion

In my case I would like entry-point to look like this for instance:

(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?

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.

@skydread1 skydread1 linked a pull request Apr 17, 2024 that will close this issue
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 a pull request may close this issue.

1 participant