-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: linux static image compilation (#13)
- Loading branch information
1 parent
d7edb0a
commit 5fa38f2
Showing
9 changed files
with
196 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v2021.05.24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eou pipefail | ||
|
||
KET_XMX=${KET_XMX:-"-J-Xmx48500m"} | ||
|
||
if [ -z "$GRAALVM_HOME" ]; then | ||
echo "Please set GRAALVM_HOME" | ||
exit 1 | ||
fi | ||
|
||
KET_JAR=${KET_JAR:-"target/ket-uber.jar"} | ||
|
||
if [[ ! -f "$KET_JAR" ]] | ||
then | ||
echo "Please run make uberjar first." | ||
exit 1 | ||
fi | ||
|
||
args=( "-jar" | ||
"$KET_JAR" | ||
"-H:Name=ket" | ||
"-H:IncludeResources=KET_VERSION" | ||
"--verbose" | ||
"--no-server" | ||
"--enable-https" | ||
"--no-fallback" | ||
"--language:js" | ||
"--allow-incomplete-classpath" | ||
"--initialize-at-build-time" | ||
"--enable-all-security-services" | ||
"--initialize-at-run-time=org.httpkit.client.HttpClient" | ||
"--initialize-at-run-time=org.httpkit.client.SslContextFactory" | ||
"--report-unsupported-elements-at-runtime" | ||
"-J-Dclojure.compiler.direct-linking=true" | ||
"-H:ReflectionConfigurationFiles=graalvm/reflect-config.json" | ||
"-H:+ReportExceptionStackTraces" | ||
"-H:IncludeResources=logback.xml" | ||
"$KET_XMX") | ||
|
||
KET_STATIC=${KET_STATIC:-} | ||
KET_MUSL=${KET_MUSL:-} | ||
|
||
if [ "$KET_STATIC" = "true" ]; then | ||
args+=("--static") | ||
if [ "$KET_MUSL" = "true" ]; then | ||
args+=("--libc=musl") | ||
fi | ||
fi | ||
|
||
"$GRAALVM_HOME/bin/native-image" "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
MUSL_DIR=${HOME}/.musl | ||
|
||
MUSL_GCC_COMPILER=${HOME}/.musl/bin/musl-gcc | ||
|
||
if [ -f "$MUSL_GCC_COMPILER" ]; then | ||
echo "MUSL is already setup at ${MUSL_DIR}" | ||
exit 0 | ||
fi | ||
|
||
MUSL_VERSION=1.2.2 | ||
ZLIB_VERSION=1.2.11 | ||
|
||
mkdir $MUSL_DIR || true | ||
cd $MUSL_DIR | ||
curl https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz -o musl-${MUSL_VERSION}.tar.gz \ | ||
&& tar zxvf musl-${MUSL_VERSION}.tar.gz \ | ||
&& cd musl-${MUSL_VERSION} \ | ||
&& ./configure --disable-shared --prefix=${MUSL_DIR} \ | ||
&& make \ | ||
&& make install \ | ||
&& curl https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz -o zlib-${ZLIB_VERSION}.tar.gz \ | ||
&& tar zxvf zlib-${ZLIB_VERSION}.tar.gz \ | ||
&& cd zlib-${ZLIB_VERSION} \ | ||
&& ./configure --static --prefix=${MUSL_DIR} \ | ||
&& make \ | ||
&& make install | ||
|
||
export PATH=$PATH:${MUSL_DIR}/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters