docker-clojure icon indicating copy to clipboard operation
docker-clojure copied to clipboard

clojurescript variants that have nodejs pre-installed?

Open cap10morgan opened this issue 5 years ago • 10 comments

Should we consider adding clojurescript images that pre-install node, npm, etc.?

cap10morgan avatar Jun 26 '20 16:06 cap10morgan

Yes! I am currently using a custom Dockerfile for ClojureScript development that builds on the clojure image to pre-install nodejs. I'd rather skip the Dockerfile and have the complete setup in docker-compose. It would be great if clojure:latest have nodejs pre-installed, providing a kitchen-sink image for clojure(script) development.

njordhov avatar Jul 05 '20 20:07 njordhov

@njordhov Hmm... interesting idea. I was thinking of just creating official clojurescript images with all the other tags we generate but with latest LTS node / npm stuff pre-installed and the latest clojurescript pre-downloaded. And then clojurescript:latest would have lein, boot, and tools-deps stuff pre-installed like we recently started doing with clojure:latest. What do you think of that?

Thoughts @Quantisan?

cap10morgan avatar Jul 07 '20 16:07 cap10morgan

@cap10morgan a separate image sounds good to keep it clean. Otherwise, I haven't used clojurescript for ages so I don't know what toolsets are needed anymore.

Quantisan avatar Jul 07 '20 20:07 Quantisan

@cap10morgan A separate clojurescript image is fine, particularly when going beyond a kitchen-sink image. Thank you for all your work in making this happen.

njordhov avatar Jul 09 '20 20:07 njordhov

Please no; AFIK there is no cljs builder that uses node in process.

You just need the node_modules folder.

Just do like this:

FROM node:alpine AS node
COPY package.json package-lock.json ./
RUN npm install

FROM openjdk-16-tools-deps-alpine
COPY --from=node node_modules node_modules
RUN clojure -A:shadow-cljs release app 

souenzzo avatar Sep 26 '20 16:09 souenzzo

@souenzzo That's an argument for why you don't need it (not why it would be undesirable nor why others shouldn't need it). If we created it and you still didn't need it, you could just not use it. The other images aren't going away.

cap10morgan avatar Sep 26 '20 16:09 cap10morgan

@souenzzo I still have a use-case for this, using leiningen/fighweel-main which uses webpack for post-processing/bundling.

call-a3 avatar Oct 01 '20 10:10 call-a3

Came here from @plexus's tip on https://github.com/thheller/shadow-cljs/issues/579. The fix is just:

FROM docker.io/clojure:temurin-18-tools-deps-focal
RUN apt-get update; apt-get -y install nodejs

I've pushed it to docker.io/nivekuil/clojure-with-node for the lazy.

nivekuil avatar Jul 19 '22 09:07 nivekuil

This is still something I'd like to do. I think it will involve changing some fundamental assumptions in our build system, so the work involved there is the big hurdle.

cap10morgan avatar Jul 19 '22 14:07 cap10morgan

Tangental tip for those using the clojure docker image with CircleCI and wanting to add nodejs support: you can add nodejs easily enough with their node orb. Here's how I did this for cljdoc's build.

lread avatar Apr 21 '24 01:04 lread