From d63e233648ffb919783d2711b09ea7dc1190ee70 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 11 Sep 2024 18:15:29 +0200 Subject: [PATCH] Improve runtime image. --- tools/runtime/Dockerfile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tools/runtime/Dockerfile b/tools/runtime/Dockerfile index 96e12e096..355e48397 100644 --- a/tools/runtime/Dockerfile +++ b/tools/runtime/Dockerfile @@ -82,16 +82,20 @@ RUN mkdir -p /usr/local/scripts \ && rm -rf $METACALL_PATH/metacall-runtime.sh # Copy libraries from builder -COPY --from=builder /usr/local/lib/*.so /usr/local/lib/*.so* /usr/local/lib/*.dll /usr/local/lib/*.js /usr/local/lib/*.ts /usr/local/lib/*.node /usr/local/lib/ - -# Copy plugins from builder -COPY --from=builder /usr/local/lib/plugins /usr/local/lib/plugins - -# Copy node dependencies (and port) from builder -COPY --from=builder /usr/local/lib/node_modules/ /usr/local/lib/node_modules/ - -# Copy python dependencies (and port) from builder -COPY --from=builder /usr/local/lib/python3.*/dist-packages/metacall/ /usr/local/lib/python3.*/dist-packages/metacall/ +COPY --from=builder /usr/local/lib/ /usr/local/lib/ + +# Delete unwanted files from libraries +RUN ls /usr/local/lib/ \ + | grep -v '.*\.so$' \ + | grep -v '.*\.so.*' \ + | grep -v '.*\.dll$' \ + | grep -v '.*\.js$' \ + | grep -v '.*\.ts$' \ + | grep -v '.*\.node$' \ + | grep -v '^plugins$' \ + | grep -v '^node_modules$' \ + | grep -v '^python3\..*' \ + | xargs rm -rf # Copy headers from builder COPY --from=builder /usr/local/include/metacall /usr/local/include/metacall