clojurescript variants that have nodejs pre-installed?
Should we consider adding clojurescript images that pre-install node, npm, etc.?
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 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 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.
@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.
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 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.
@souenzzo I still have a use-case for this, using leiningen/fighweel-main which uses webpack for post-processing/bundling.
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.
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.
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.