From ffb92bc8db83225f346f5cec36c4f843993a7c5e Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sun, 9 Feb 2020 23:28:18 +0100 Subject: [PATCH] Docker --- Dockerfile | 2 +- script/compile | 61 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index e2c96de9..d62d3154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV PATH="$PATH:$JAVA_HOME" COPY . . RUN apt install -y sudo RUN ./.circleci/script/install-leiningen -RUN ./script/compile +RUN GRAALVM_STATIC=true ./script/compile RUN cp bb /usr/local/bin diff --git a/script/compile b/script/compile index fbb59dc7..eacd71e8 100755 --- a/script/compile +++ b/script/compile @@ -26,24 +26,47 @@ export JAVA_HOME=$GRAALVM_HOME lein with-profiles +reflection do run lein do clean, uberjar -$GRAALVM_HOME/bin/native-image \ - -jar target/babashka-$BABASHKA_VERSION-standalone.jar \ - -H:Name=bb \ - -H:+ReportExceptionStackTraces \ - -J-Dclojure.spec.skip-macros=true \ - -J-Dclojure.compiler.direct-linking=true \ - "-H:IncludeResources=BABASHKA_VERSION" \ - "-H:IncludeResources=SCI_VERSION" \ - -H:ReflectionConfigurationFiles=reflection.json \ - --initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \ - --initialize-at-build-time \ - -H:Log=registerResource: \ - -H:EnableURLProtocols=http,https \ - --enable-all-security-services \ - -H:+JNI \ - --verbose \ - --no-fallback \ - --no-server \ - "$BABASHKA_XMX" +if [ "$GRAALVM_STATIC" = "true" ]; then + $GRAALVM_HOME/bin/native-image \ + -jar target/babashka-$BABASHKA_VERSION-standalone.jar \ + -H:Name=bb \ + -H:+ReportExceptionStackTraces \ + -J-Dclojure.spec.skip-macros=true \ + -J-Dclojure.compiler.direct-linking=true \ + "-H:IncludeResources=BABASHKA_VERSION" \ + "-H:IncludeResources=SCI_VERSION" \ + -H:ReflectionConfigurationFiles=reflection.json \ + --initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \ + --initialize-at-build-time \ + -H:Log=registerResource: \ + -H:EnableURLProtocols=http,https \ + --enable-all-security-services \ + -H:+JNI \ + --verbose \ + --no-fallback \ + --no-server \ + "$BABASHKA_XMX" \ + --static +else + $GRAALVM_HOME/bin/native-image \ + -jar target/babashka-$BABASHKA_VERSION-standalone.jar \ + -H:Name=bb \ + -H:+ReportExceptionStackTraces \ + -J-Dclojure.spec.skip-macros=true \ + -J-Dclojure.compiler.direct-linking=true \ + "-H:IncludeResources=BABASHKA_VERSION" \ + "-H:IncludeResources=SCI_VERSION" \ + -H:ReflectionConfigurationFiles=reflection.json \ + --initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \ + --initialize-at-build-time \ + -H:Log=registerResource: \ + -H:EnableURLProtocols=http,https \ + --enable-all-security-services \ + -H:+JNI \ + --verbose \ + --no-fallback \ + --no-server \ + "$BABASHKA_XMX" +fi lein clean