This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-31
Channels
- # aleph (12)
- # announcements (4)
- # asami (7)
- # babashka (20)
- # beginners (92)
- # calva (74)
- # clj-kondo (8)
- # cljdoc (70)
- # clojure (47)
- # clojure-dev (29)
- # clojure-europe (27)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojurescript (7)
- # cursive (2)
- # datomic (1)
- # emacs (8)
- # events (5)
- # fulcro (36)
- # gratitude (4)
- # humbleui (25)
- # introduce-yourself (1)
- # lsp (26)
- # malli (6)
- # missionary (8)
- # nbb (50)
- # off-topic (9)
- # pathom (2)
- # pedestal (3)
- # portal (32)
- # practicalli (5)
- # reitit (5)
- # releases (1)
- # ring (6)
- # shadow-cljs (87)
- # sql (31)
- # tools-deps (26)
- # vim (3)
- # xtdb (15)
A quick article on how I am uhttps://practical.li/blog/posts/build-and-run-clojure-with-multistage-dockerfile/. I use this approach mostly for the continuous integration pipeline, although I am using docker compose for local testing with the relational database the current company I work for uses
https://practical.li/blog/posts/build-and-run-clojure-with-multistage-dockerfile/
If you have any suggestions or improvements to tweak the Dockerfile, please share them (I am considering if there are any commands I want to string together with &&
to reduce the number of layers. I want to balance this with maximising the docker cache and keeping the Dockerfile pleasant to work with 🙂
One thing you can do in many (most?) cases is to use the JRE variant of Eclipse Temurin images, for the containers that are finally run. Those images don't need the full JDK at all, just the JRE subset. You shave several dozen megabytes from the final image 😁
I did initially consider using a JRE to save even more space (thinking about that since Java 9 though). The Eclipse-temurin readme recommends building the JRE image and I’d probably feel compelled to figure out how to optimise that with module choice or be paranoid I missed something 🙂
I could use 17-jre-alpine
although then I am using a (slightly) different image to run the service to that which was used to build it, as the Clojure image uses 17-jdk-alpine
. I’ll add using a JRE to my todo list and do some testing. Thanks.
This is really helpful @U05254DQM, thanks! I'll likely apply at least some of the knowledge you shared to cljdoc's somewhat neglected Dockerfile.
To use a Java Run-time Environment (JRE) rather than the full JDK, then I could use a Multi-stage docker file like this https://gist.github.com/practicalli-john/84c8900d95fe3729c5ccd17ef3b26bb4 (although I havent tried it yet 🙂