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.
master
Dustin 2024-01-14 19:01:20 -06:00
parent d44e7df8cf
commit 79de375b30
1 changed files with 7 additions and 1 deletions

View File

@ -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' \