statically compiled arm64 pkl binary for usage in distroless containers #320

Open
opened 2025-12-30 01:23:31 +01:00 by adam · 2 comments
Owner

Originally created by @wfairclough on GitHub (Jul 20, 2025).

Hey team, we’re running PKL in arm64 distroless containers and hit a snag: the current PKL release isn’t statically compiled for arm64, so we’re running into dependency issues at runtime. Would it be possible to provide a statically compiled arm64 version of PKL as part of the release artifacts? This would make it much easier to use PKL in minimal container environments.

We really want to use pkl as our go to config language for our services, we love the protection we would get with runtime config validation.

I tried making the changes myself and successfully compiled an arm64 statically compiled binary on an arm64 Ubuntu VM. However, it still did not work in the distroless container. I assumed I must have done something wrong and that I did not actually achieve a static compilation.
The changes I made to the build scripts are here: pkl-cli/pkl-cli.gradle.kts

Thanks!

Originally created by @wfairclough on GitHub (Jul 20, 2025). Hey team, we’re running PKL in arm64 [distroless](https://github.com/GoogleContainerTools/distroless/tree/main/base) containers and hit a snag: the current PKL release isn’t statically compiled for arm64, so we’re running into dependency issues at runtime. Would it be possible to provide a statically compiled arm64 version of PKL as part of the release artifacts? This would make it much easier to use PKL in minimal container environments. We really want to use pkl as our go to config language for our services, we love the protection we would get with runtime config validation. I tried making the changes myself and successfully compiled an arm64 statically compiled binary on an arm64 Ubuntu VM. However, it still did not work in the distroless container. I assumed I must have done something wrong and that I did not actually achieve a static compilation. The changes I made to the build scripts are here: [pkl-cli/pkl-cli.gradle.kts](https://github.com/wfairclough/pkl/commit/fbe13d82c0c6b138776c87a8040230deb037b204#diff-bdf5449abccf0b8046f34537181924829541b9bf179ffbebba04a2f407c59f7b) Thanks!
Author
Owner

@bioball commented on GitHub (Jul 22, 2025):

The existing linux/arm64 executable is a "mostly static", where it dynamically links to glibc and libstd++. Can you try using distroless/cc as your base image? That should have all the dependencies that Pkl needs.

@bioball commented on GitHub (Jul 22, 2025): The existing linux/arm64 executable is a "mostly static", where it dynamically links to glibc and libstd++. Can you try using `distroless/cc` as your base image? That should have all the dependencies that Pkl needs.
Author
Owner

@wfairclough commented on GitHub (Jul 22, 2025):

@bioball, thank you for your suggestion. I tried that as well, but it seems there are more missing dependencies.

Image
@wfairclough commented on GitHub (Jul 22, 2025): @bioball, thank you for your suggestion. I tried that as well, but it seems there are more missing dependencies. <img width="962" height="232" alt="Image" src="https://github.com/user-attachments/assets/75875ec2-6ab8-4231-b80a-6cc8856bc322" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#320