Fork me on GitHub
#docker
<
2022-03-14
>
V11:03:39

Hey guys. I haven't worked much with containers, so this might be obvious to some of you. I've created my uberjar, created the image and run everything in docker-compose. However, my application relies on some resources in the uberjar. How do i use those? Right now i get this error: " Caused by: java.lang.IllegalArgumentException: Not a file: jar:file:/app/application-0.0.0-SNAPSHOT-standalone.jar!/json/data" even though this should be the location of these resources.

pavlosmelissinos12:03:26

Can you successfully run the uberjar outside of docker? Seems like you need to add json/data to the classpath but if that were the case the uberjar wouldn't work at all.

V12:03:28

Well i actually don't know. I have about 30 environment variables that need to be passed for the system to start up. I can run the main with those variables and it works fine, but i am unsure how i would parse those to the uberjar?

pavlosmelissinos12:03:32

Well, the uberjar is created before you do anything with docker, so if the uberjar doesn't work this isn't a docker-related question. How are you building the uberjar? tools.build/depstar/something else?

V12:03:56

leiningen

pavlosmelissinos12:03:19

Passing environment variables to docker-compose is https://docs.docker.com/compose/environment-variables/ but no matter what you do it won't work if your uberjar is broken. I'm not familiar with leiningen but if I were you I'd focus my efforts there, with help from #leiningen

V12:03:05

Alright, thanks a lot. I will try my luck there then 🙂

V11:03:07

Maybe i am going about this the wrong way?