GraalVM native image

Had the same issue because in my Dockerfile I used the latest version of musl toolchain. I now use this version from musl.cc: https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz and it works!

sudo apt install build-essential libz-dev zlib1g-dev
wget https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz
mv x86_64-linux-musl-native.tgz /opt
cd /opt && tar xf x86_64-linux-musl-native.tgz
#https://www.graalvm.org/22.1/reference-manual/native-image/StaticImages/
cd ~/Downloads
wget https://zlib.net/zlib-1.2.13.tar.gz
export TOOLCHAIN_DIR=/opt/x86_64-linux-musl-native/
export CC=$TOOLCHAIN_DIR/bin/gcc
export PATH="$TOOLCHAIN_DIR/bin:$PATH"
tar xf zlib-1.2.13.tar.gz
cd zlib-1.2.13
./configure --prefix=$TOOLCHAIN_DIR --static
make
make install
    <profiles>
        <profile>
            <id>native</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.hibernate.orm.tooling</groupId>
                        <artifactId>hibernate-enhance-maven-plugin</artifactId>
                        <version>${hibernate.version}</version>
                        <executions>
                            <execution>
                                <id>enhance</id>
                                <goals>
                                    <goal>enhance</goal>
                                </goals>
                                <configuration>
                                    <failOnError>true</failOnError>
                                    <enableLazyInitialization>true</enableLazyInitialization>
                                    <enableDirtyTracking>true</enableDirtyTracking>
                                    <enableAssociationManagement>true</enableAssociationManagement>
                                    <enableExtendedEnhancement>false</enableExtendedEnhancement>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>build-native</id>
                                <goals>
                                    <goal>compile-no-fork</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <imageName>atv</imageName>
                            <buildArgs>
                                <buildArg>
                                    --static
                                    --verbose
                                    --libc=musl
                                    --enable-http
                                    --enable-https
                                    -H:DynamicProxyConfigurationFiles=${project.basedir}/dynamic-proxy.json
                                </buildArg>
                            </buildArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

ARM64

cd web-ui && npm i
wget https://musl.cc/aarch64-linux-musl-cross.tgz
wget http://musl.cc/aarch64-linux-musl-native.tgz