Fork me on GitHub
#graalvm
<
2019-05-22
>
borkdude18:05:46

if I don’t want to build a --static image, what should I copy to a Docker image in order for the binary to work?

gklijs18:05:01

Since it's based on llvm, I guess you could take any of the slim debian images https://hub.docker.com/_/debian and just add the binary?

borkdude18:05:35

What’s the trade off between slim debian or alpine?

gklijs18:05:41

Alpine isn't llvm but musl, although it appears you can get llvm on alpine as well https://pkgs.alpinelinux.org/package/v3.3/main/x86/llvm. Don't know much about it but ran into it trying to minimise a Rust image (which can be very small, as long as there is no c interop..)

lispyclouds18:05:05

not sure if it affects substrate vm

borkdude18:05:46

I’ve already found something out. It can be done by using alpine + https://github.com/sgerrand/alpine-pkg-glibc

borkdude18:05:51

@gklijs @rahul080327 this seems to work (based on Alpine, I don’t know anything about LLVM vs MUSL)

Borkdude@michiel ~/Dropbox/dev/clojure/clj-kondo (master*) $ clj-kondo --lint src
...
linting took 305ms, errors: 0, warnings: 3
Borkdude@michiel ~/Dropbox/dev/clojure/clj-kondo (master*) $ docker run -v $PWD/src:/src borkdude/clj-kondo clj-kondo --lint /src
...
linting took 372ms, errors: 0, warnings: 4

borkdude18:05:29

Docker is only slightly slower

gklijs18:05:43

How large is the image?

borkdude18:05:23

yes, using ubuntu as the base there

lispyclouds18:05:39

okay so the alpine is just to reduce the size

borkdude18:05:44

but since I’m not compiling it to a static binary, it needs those libc libraries at the bottom still

borkdude18:05:16

(the reason I’m not compiling to static is that it doesn’t work on Mac and I’d like to keep the script the same - although I could change that)

lispyclouds18:05:34

i guess this is the only solution then. maybe having a static build against musl might reduce it a bit more but i dont anticipate much

lispyclouds18:05:29

the aim here is only to reduce the image size?

borkdude18:05:48

linting my whole project takes the same amount of time in Docker as on Mac natively, so I think it’s good now

borkdude18:05:58

the last step (from Alpine) is indeed to reduce to size

lispyclouds18:05:55

yeah i dont think there is any other option.

borkdude18:05:10

30MB is fine with me, as long as it’s not 200MB or bigger 😉

lispyclouds18:05:37

yep 🙏:skin-tone-3:

lispyclouds18:05:42

im just a bit wary of some perf surprises alpine had for me. but they were long running stuff and hit the GC mostly. this should be okay

lispyclouds18:05:16

that scarred me into using plain debian images 😛

borkdude18:05:26

debian slim?

borkdude18:05:39

how big would those images be?

borkdude18:05:42

compared to Alpine

lispyclouds18:05:04

maybe some tens of MB

lispyclouds18:05:20

but you wont have stuff like GCC

lispyclouds18:05:37

installing that is a time/space waste again

borkdude18:05:46

I’ll keep it in the back of my mind if I run into problems with this

lispyclouds18:05:58

yeah mostly should be fine. i assume clj kondo doesnt allocate multi gigabyte heaps 😛

borkdude18:05:33

I hope not 😉