For context, I'm building a java application compiled to GraalVM native image running on a distroless docker image in Kubernetes.
I've been trying to do something rather simple and hit a wall: I'd like to set custom heap size limits per environment via -XmxNNN
. To do that, the options with which I'd like to run the application would be held in an environment variable. The problem arises due to the usage of a distroless image - which doesn't have bash and so ENTRYPOINT /application $OPTIONS
doesn't work.
Is there an environment variable GraalVM supports on its own, or any other way of setting this?
I dont want to:
- hardcode the values in the Docker image
- hardcode the values by predefining them during native-image build
You could use
busybox
to get a shell inside a distroless container:You can find an example to this kind of
Dockerfile
here.But I don't think this busybox shell is necessary needed.
Altough
ENTRYPOINT /application $OPTIONS
does not work, this will workENTRYPOINT ["myapp", "arguments"]
source: github