Last active
August 24, 2022 03:23
-
-
Save veysiertekin/caf6581cd172c67212a8f3ee4b983f71 to your computer and use it in GitHub Desktop.
Graal GraalVM
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
ARG GRAALVM_VERSION="ol8-java17-22.2.0" | |
FROM ghcr.io/graalvm/graalvm-ce:$GRAALVM_VERSION | |
ARG TARGETARCH | |
ARG UPX_VERSION="3.96" | |
ARG UPX_FILE="upx-$UPX_VERSION-${TARGETARCH}_linux" | |
ARG UPX_PKG="https://github.com/upx/upx/releases/download/v$UPX_VERSION/${UPX_FILE}.tar.xz" | |
RUN microdnf --enablerepo ol8_codeready_builder install xz \ | |
&& microdnf clean all \ | |
&& curl --fail --location --retry 3 --output upx-archive.tar.xz $UPX_PKG \ | |
&& tar -xJf upx-archive.tar.xz $UPX_FILE/upx \ | |
&& cp $UPX_FILE/upx /bin/ && rm -rf upx-* | |
RUN gu install native-image | |
# BEGIN PRE-REQUISITES FOR STATIC NATIVE IMAGES FOR GRAAL | |
# SEE: https://github.com/oracle/graal/blob/master/substratevm/StaticImages.md | |
ARG RESULT_LIB="/staticlibs" | |
# Install native support | |
### | |
RUN mkdir -p ${RESULT_LIB}/bin | |
# Install musl | |
RUN curl -L -o musl.tar.gz https://musl.libc.org/releases/musl-1.2.1.tar.gz && \ | |
mkdir musl && tar -xvzf musl.tar.gz -C musl --strip-components 1 && cd musl && \ | |
./configure --disable-shared --prefix=${RESULT_LIB} && \ | |
make && make install && \ | |
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ${RESULT_LIB}/lib/ && \ | |
ln ${RESULT_LIB}/bin/musl-gcc ${RESULT_LIB}/bin/x86_64-linux-musl-gcc | |
# Do not change location of this variable. It is getting used by below command. | |
ENV CC="${RESULT_LIB}/bin/musl-gcc" | |
# Install zlib | |
RUN curl -L -o zlib.tar.gz https://zlib.net/zlib.tar.gz && \ | |
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && cd zlib && \ | |
./configure --static --prefix=${RESULT_LIB} && \ | |
make && make install | |
#END PRE-REQUISITES FOR STATIC NATIVE IMAGES FOR GRAAL | |
# Install sbt wrapper as sbt command | |
# Provides same functionality. Also allows sbt version parameters as well: | |
# -sbt-version <sbt version> | |
# -scala-version <scala version> | |
# For more detail: https://github.com/dwijnand/sbt-extras/blob/master/sbt | |
RUN curl -Ls https://git.io/sbt > "/bin/sbt" && chmod +x "/bin/sbt" | |
ENV PATH="$PATH:${RESULT_LIB}/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
ARG GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc" | |
ARG GLIBC_VERSION="2.30-r0" | |
FROM alpine:3.16 | |
ARG GLIBC_REPO | |
ARG GLIBC_VERSION | |
# Install glibc | |
RUN set -ex && \ | |
apk --update add libstdc++ curl ca-certificates && \ | |
for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \ | |
do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \ | |
apk add --allow-untrusted /tmp/*.apk && \ | |
rm -v /tmp/*.apk && \ | |
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib |
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
ARG GRAALVM_VERSION="ol8-java17-22.2.0" | |
FROM ghcr.io/graalvm/graalvm-ce:$GRAALVM_VERSION | |
ARG TARGETARCH | |
ARG UPX_VERSION="3.96" | |
ARG UPX_FILE="upx-$UPX_VERSION-${TARGETARCH}_linux" | |
ARG UPX_PKG="https://github.com/upx/upx/releases/download/v$UPX_VERSION/${UPX_FILE}.tar.xz" | |
RUN microdnf --enablerepo ol8_codeready_builder install xz \ | |
&& microdnf clean all \ | |
&& curl --fail --location --retry 3 --output upx-archive.tar.xz $UPX_PKG \ | |
&& tar -xJf upx-archive.tar.xz $UPX_FILE/upx \ | |
&& cp $UPX_FILE/upx /bin/ && rm -rf upx-* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment