docker 2018-08-29

lein is not part of clojure -- third party build tool

I generally avoid putting lein in production images

instead opting to make an uberjar -- then build a cut-down image to run it

alpine isn't really officially supported until JDK11 - which comes out in September

Yeah so for me cljs is my aim but I'm using deps.edn so I need clojure

if you use deps.edn the easiest thing is to run the linux installer script within the docker build

doesn't that suffice for everyone?

(TLDR there was a JDK8 alpine build, then none for JDK9/10, coming officially back for JDK11)

i guess you won't have a repl but why would one need it?

I built something that works

what do you mean? If you have the clojure jar available, you can get a REPL

@pauld has joined the channel

trying to stretch it and see it breaks

java -cp clojure.jar clojure.main

but the repl via clj needs rlwrap

right, that's just a convenience for non-brutal terminal interaction

you still have a normal repl by launching clojure

but yeah what i have seems to work so far but I'm not 100% sure yet

(I missed the beginning of this convo: What are you trying to do?)

Trying to get clojure on an alpine image

glibc or musl?

there's a dockerfile in the reply ^

you can get it to 30MB -- I wouldn't recommend Alpine musl JDK, because that limits you to JDK8

but now trying with a base alpine image

I want jdk8 because that's stable

hmm I guess I don't have to hold so tightly to alpine

I have this

FROM alpine:3.8

RUN apk update && apk add nodejs-npm openjdk8 chromium git curl

RUN curl -O 
RUN chmod +x linux-install-1.9.0.391.sh
RUN ./linux-install-1.9.0.391.sh
RUN rm linux-install-1.9.0.391.sh

RUN npm install -g yarn

I use jlink, an official tool to make a smaller JVM

waiting for the build to finish

that seems legit

kinda bloated because I need to do browser tests haha

what's the chromium for?

Worked ok with base clojure:alpine now trying with alpine:3.8

but image is still not under 100M

which isn't a hard requirement but cool to have

weird how clojure:alpine doesn't have clojure

yeah they're using a name that sounds official but isn't

there's some circle-CI images that use tools.deps that you can use as inspiration. They're not small though

clojure:tools-deps-alpine has clojure

You are just using wrong tag

yeah that list isn't complete

FROM openjdk:10 as jdk
RUN jlink \
  --strip-debug \
  --compress=1 \
  --vm=server \
  --output /tmp/linkedjdk \
  --add-modules 

FROM debian:stretch-slim
COPY --from=jdk /tmp/linkedjdk /jdk/
# This is temporarily necessary as it appears the new OpenJDK TrustStore is incomplete
# Apparently, AWS's Step Function endpoint uses a different signing root than S3
COPY --from=jdk /docker-java-home/lib/security/cacerts /jdk/lib/security/
COPY clojure.jar /app
ENTRYPOINT ["/jdk/bin/java" "-jar" "/app/clojure.jar"]
That's a full glibc jvm with debian for about 120MB

you can remove modules and get smaller, but you'll lose some parts of the jdk

hmm I probably don't want that

I could just use clojure:tools-deps-alpine and save myself the pain of maintaining things

I mean I probably don't want to lose parts of the jdk > hmm I probably don't want that

Yes, nothing fancy in there)

but uses $CLOJURE_VERSION

I didn't want fancy

I wonder why they installed rlwrap though

since I assume people won't want a repl 😛

they should change ENV to ARG on CLOJURE_VERSION

I wonder why the name tools-deps-alpine I couldn't have get that via a google search

probably should replace clojure:alpine with this

*they should probably

clojure:alpine historically reserved for lein tool not for tools-deps

what does tools deps mean if I may ask?

I was searching google for a lot of things but not tools deps 🙂

related to deps.edn?

yes

Ok then it's what I want

deps.edn and tools.deps works together only

and if you have a closer look into clojure executable script you will find something related to tools.deps

hmmm thanks I guess it's what I want because I want to make sure my deps.edn installs succeed

@joephayes has joined the channel