I have built an API in Micronaut and trying to deploy in it GCP Cloud Run as a native graalVM image
This is my Dockerfile
# Stage 1: Build the JAR
FROM gradle:jdk11 as gradle
COPY --chown=gradle . /home/app
WORKDIR /home/app
RUN gradle assemble --no-daemon
# Stage 2: Build the native image
FROM ghcr.io/graalvm/graalvm-ce:latest as graalvm
RUN \
# Install GraalVM Native Image
gu install native-image;
COPY --from=gradle /home/app/build/libs/greetings-cloud-run-0.1-all.jar /home/app/server.jar
WORKDIR /home/app
RUN native-image -H:Name=greetings-cloud-run --no-server -cp server.jar com.arun.Application
# Stage 3: Prepare Server
FROM frolvlad/alpine-glibc
RUN apk update && apk add libstdc++
EXPOSE 8080
COPY --from=graalvm /home/app/greetings-cloud-run .
ENTRYPOINT ["./greetings-cloud-run"]
I checked till Stage-2 and the native image is running perfectly fine. I included Stage-3 to run my native-image and ending up with below error
$ docker run a/micro
./greetings-cloud-run: /usr/lib/libstdc++.so.6: no version information available (required by ./greetings-cloud-run)
./greetings-cloud-run: Relink `/usr/lib/libgcc_s.so.1' with `/usr/glibc-compat/lib/libc.so.6' for IFUNC symbol `memset'
Need help on how to run my Native image
RUN apk ...can be removed and instead, one could addUSER nonroot(see quarkus documentation on distoless base images). Rest should work as-is. - Turing85