From 79de375b30a51d7149e0add27ffb9b035bd821d8 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 14 Jan 2024 19:01:20 -0600 Subject: [PATCH] container: Fix kcl runtime As it turns out, KCL literally *compiles* a program from the KCL sources. The program it creates needs to link with its runtime library, `libkclvm_cli_cdylib.so`. The `kcl` command extracts this library, along with a helper utility `kclvm_cli`, which performs the actual compilation and linking. In a container, `/root/go` is probably mounted read-only, so we need to extract these files ahead of time and put them in another location, so the `kcl` command does not have to do it each time it runs. --- Containerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Containerfile b/Containerfile index 218a4c7..2cc4f0e 100644 --- a/Containerfile +++ b/Containerfile @@ -10,7 +10,8 @@ RUN --mount=type=cache,target=/var/cache \ RUN --mount=type=cache,target=/root/go \ go install kcl-lang.io/cli/cmd/kcl@v0.7 \ - && cp /root/go/bin/kcl /usr/local/bin \ + && /root/go/bin/kcl > /dev/null \ + && cp /root/go/bin/* /usr/local/bin/ \ && : RUN --mount=type=cache,target=/root/.cargo \ @@ -26,6 +27,7 @@ RUN --mount=type=cache,target=/var/cache \ microdnf install -y \ --setopt install_weak_deps=0 \ age \ + gcc \ git \ && cp -a /build/usr/local/bin/. /usr/local/bin \ && for cmd in \ @@ -40,5 +42,9 @@ COPY config.sh / CMD ["/config.sh"] +ENV KCL_GO_DISABLE_ARTIFACT=on +ENV KCL_PKG_PATH=/tmp +ENV KCL_CACHE_PATH=/tmp + LABEL license= \ vendor='Dustin C. Hatch' \