This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-21
Channels
- # announcements (26)
- # babashka (115)
- # babashka-sci-dev (5)
- # beginners (48)
- # calva (69)
- # cider (4)
- # clj-commons (11)
- # clj-kondo (1)
- # cljfx (29)
- # clojure (109)
- # clojure-art (1)
- # clojure-czech (1)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-nlp (3)
- # clojure-norway (7)
- # clojure-uk (1)
- # clojurescript (63)
- # clr (1)
- # data-science (41)
- # datalevin (1)
- # datomic (11)
- # emacs (58)
- # etaoin (11)
- # figwheel-main (1)
- # fulcro (5)
- # google-cloud (12)
- # helix (2)
- # honeysql (21)
- # hyperfiddle (22)
- # joyride (53)
- # malli (52)
- # off-topic (27)
- # portal (4)
- # re-frame (19)
- # releases (3)
- # ring-swagger (5)
- # xtdb (30)
Docker image
I was trying to build the docker image from the master
branch but it is failing for me
Execution error (FileNotFoundException) at babashka.impl.common/eval187$loading (common.clj:1).
Could not locate sci/ctx_store__init.class, sci/ctx_store.clj or sci/ctx_store.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
Full report at:
/tmp/clojure-1249190392639535167.edn
Error encountered performing task 'do' with profile(s): 'base,system,user,provided,dev,xml,yaml,csv,transit,httpkit-client,httpkit-server,core-match,hiccup,test-check,selmer,logging,priority-map,reflection'
Suppressed exit
The command '/bin/sh -c ./script/uberjar' returned a non-zero code: 1
I’ve tried with BABASHKA_LEAN=true
as well, without much luck
$ docker build --build-arg BABASHKA_LEAN=true -t babashka:slim .
@UJSBQNUG6 did you clone the babashka repo with --recursive
? It has git submodules
yes, I’ve just realized this in this exact minute 😄
this was the Docker issue I was talking about earlier in another thread
@UJSBQNUG6 thanks for the change, just fyi this reduces the image of the docker image for local consumption and not the ones we push out to the registry. what exactly was the issue you were facing?
well, then I guess we need to modify
or I don’t know which one is pushed to the registry
but IIRC that had the same issue
yeah thats pretty lean anyways. we simply pack the binary in it. the one you changed is where its built
this image has the same issue, it does an apt-get update
without removing the package information later
if you check the 7th layer you can see that
ah yes, do you wanna update the PR then? its more useful in http://Dockerfile.ci actually
sure, I can
should I revert my changes in the Dockerfile
?
can keep it, if someone is building off it locally
would apk too have something similar? https://github.com/babashka/babashka/blob/master/Dockerfile.alpine
although hadolint
can see a couple of issues with the images
I can fix those issues if you want
I can see that the /tmp/glibc-2.28-r0.apk
is not removed
sure go for it
also - in my opinion - if you are using multi staged builds it is not necessary to combine the RUN
commands in the build image
since the size there does not really matter since you are not pushing that anywhere and it actually hurts the build time since if anything changes it cannot use the layer cache
what is the point to install tar
in the Alpine image?
ok, and I guess the Ubuntu image has that already
if you want the absolute most minimal image, you can start from scratch
and just copy the linux static binary
why is rm graalvm-ce-java19-linux-${GRAALVM_ARCH}-${GRAALVM_VERSION}.tar.gz
removed?
because it is not necessary in the build image, as I wrote above
> also - in my opinion - if you are using multi staged builds it is not necessary to combine the RUN commands in the build image
you mean the Dockerfile
right? agreed but i dont think we use circle's layer cache. is all ephemeral machines
yes, and by local builds
adding rm /tmp/glibc-2.28-r0.apk
could further reduce the Alpine image by 2.3MB
I won’t do anymore modifications in this PR
we could address the hadolint
issues in a separate PR maybe?
yes thats what i was gonna say
some of them are false positives
$ hadolint Dockerfile*
Dockerfile:4 DL3027 warning: Do not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead
Dockerfile:5 DL3027 warning: Do not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead
Dockerfile:5 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile:70 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile:71 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile:73 DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
Dockerfile:74 DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
Dockerfile:74 DL3015 info: Avoid additional packages by specifying `--no-install-recommends`
Dockerfile.alpine:9 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
Dockerfile.alpine:9 DL3019 info: Use the `--no-cache` switch to avoid the need to use `--update` and remove `/var/cache/apk/*` when done installing packages
Dockerfile.alpine:16 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile.alpine:17 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile.alpine:18 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile.alpine:19 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
Dockerfile.alpine:24 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
Dockerfile.alpine:24 DL3019 info: Use the `--no-cache` switch to avoid the need to use `--update` and remove `/var/cache/apk/*` when done installing packages
DL3007 warning: Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
DL3015 info: Avoid additional packages by specifying `--no-install-recommends
`yeah these are too pedantic ones
the first too makes sense
also could you add a changelog entry too? can make a unreleased section in https://github.com/babashka/babashka/blob/master/CHANGELOG.md
now that i look at it why is WORKDIR "/usr/local/bin"
needed?
all the paths are absolute there
that effectively changes the pwd of the bb CMD right?
WORKDIR
will create the directory for us
true, I was not thinking about that
please don't make any changes that aren't necessary to the problem statement that goes with this PR
yeah thats not needed
lets stick to mkdir, the other one is effectively a breaking change in some sense
true, I am sorry
i'll merge it?
I don't think the docker step is ran in branches right? so waiting for CI might not make sense
thank you guys for the super quick merge
I'm seeing this when running babashka after upgrading to the latest, but only when bb.edn has :deps to install (it works fine outside of my repo):
❯ bb -e '(print "hi")'
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" java.io.FileNotFoundException:
/home/russ/.clojure/.cpcache/954D5CED186DE6EB3C969EE7C387062C.cp (No such file or directory)
It seems to fail anytime it needs to use java to install deps. (commenting out the deps in my bb.edn allows the above command to work again).
I've hit this a few times before, and usually i delete a few .cpcache
s (in the project and in ~/
) and things start working again, but it's been a while, and I feel like I'm forgetting a step in this process... are there other caches I need to delete or other workarounds for this?you should not have to delete any caches when upgrading, but if you want to by pass the caches, you can pass bb -Sforce
sure - i think i messed up my bb/clojure/java versions somehow, trying to get to the bottom of it now
v1.3.176
❯ bb --version 7:10PM
egrep: warning: egrep is obsolescent; using grep -E
babashka v1.3.176
and clojure looks like:
~/russmatney
❯ bb clojure --version 7:11PM
egrep: warning: egrep is obsolescent; using grep -E
Clojure CLI version (deps.clj) 1.11.1.1257
~/russmatney
❯ clojure --version 7:11PM
egrep: warning: egrep is obsolescent; using grep -E
Clojure CLI version 1.11.1.1224
i'm wondering if those versions should align
1224 vs 1257
if you have deleted your .m2 or .gitlibs folder then it could be that you would get such an exception, but -Sforce should fix that
gotcha - i did delete .m2 at some point, but forgot .gitlibs
bah, still the same error with all those cleared. must be something else that's wrong 😕
thanks for the help anyway - i'll dig around a bit
yeah - the deps install and i hit a repl
then moving things back and running bb again, same crash
bb -Sforce
hits the same error
bb -Sforce 7:22PM
egrep: warning: egrep is obsolescent; using grep -E
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" java.io.FileNotFoundException: /home/russ/.clojure/.cpcache/1621164B24C75150EF237DB929581D8A.cp (No such file or directory)
testing in babashka/fs
now to be sure it's not the repo
the egrep is noise, sorry
a zsh error i haven't gotten around to yet
❯ ~/.deps.clj/ 7:22PM
./ 1.10.3.1040/ 1.11.1.1149/ 1.11.1.1165/ 1.11.1.1200/ 1.11.1.1237/
../ 1.11.1.1113/ 1.11.1.1155/ 1.11.1.1182/ 1.11.1.1208/ 1.11.1.1257/
❯ l ~/.deps.clj/1.11.1.1257/ClojureTools/ 7:24PM
./ clojure-tools-1.11.1.1257.jar tools.edn
../ example-deps.edn tools.zip
just the ClojureTools dir
i think that did it
instead bb -Sforce
showed
Clojure tools not yet in expected location: /home/russ/.deps.clj/1.11.1.1257/ClojureTools/clojure-tools-1.11.1.1257.jar
Downloading to /home/russ/.deps.clj/1.11.1.1257/ClojureTools/tools.zip
Unzipping /home/russ/.deps.clj/1.11.1.1257/ClojureTools/tools.zip ...
Successfully installed clojure tools!
and a repl
confirming it's working in the original repo! yay!
it's slightly devastating when bb fails on me b/c i lose all my key bindings and window-management powers, haha
but i still love it!