# This Dockerfile builds a GraalVM Native Image Test Server with glibc support.
# Use an old version of Ubuntu to build the test server to maintain compatibility with 
# older versions of glibc, specifically glib 2.17.
FROM ubuntu:18.04
ENV JAVA_HOME=/usr/lib64/graalvm/graalvm-community-java23
COPY --from=ghcr.io/graalvm/native-image-community:23 $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
RUN apt-get -y update --allow-releaseinfo-change && apt-get install -V -y software-properties-common
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update
# We need to update gcc and g++ to 10 for Graal to work on ARM64
RUN apt-get install -y git build-essential zlib1g-dev gcc-10 g++-10
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10
# Avoid errors like: "fatal: detected dubious ownership in repository"
RUN git config --global --add safe.directory '*'