GraalVM deploy

azizbekx
FREE

a month ago

Need help to deploy spring boot graalVM deploy

here is my docker file

Stage 1: Build the native executable

FROM ghcr.io/graalvm/native-image-community:21 as native-builder
WORKDIR /app
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN ./mvnw dependency:go-offline
COPY src ./src

Build the native image. The --static flag is no longer needed or helpful.

RUN ./mvnw -Pnative native:compile -DskipTests

Stage 2: Create the final image using the 'cc' base image

This image includes the C standard libraries (glibc) needed by the .so files.

FROM gcr.io/distroless/cc-debian12
WORKDIR /app

COPY --from=native-builder /app/target/x .

COPY --from=native-builder /app/target/*.so .

Tell the Linux dynamic linker where to find our libraries.

The '.' means look in the current directory (/app).

ENV LDLIBRARYPATH=.

ENTRYPOINT ["./x"]

here is my deployment id 0d70295b-3aab-4b1d-974b-31dc57b16f14
project id

$10 Bounty

0 Replies

azizbekx
FREE

a month ago

Project id: 2198b52a-208f-4df7-80ac-a1633d27e154


azizbekx
FREE

a month ago

ok it is fixed now but I have some problem with compiling graalvm


azizbekx
FREE

a month ago

can someone share proper guidance to deploy graalvm + spring boot


What is the error you have?


```# --- Build arguments ---

IMPORTANT: Change 'your-app-name' to your pom.xml

ARG ARTIFACT_NAME=your-app-name

======================================================================================

STAGE 1: Builder

======================================================================================

FROM ghcr.io/graalvm/native-image-community:21 AS builder
WORKDIR /app

Create a layer for dependencies

COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN chmod +x ./mvnw
RUN ./mvnw dependency:resolve

Create a layer for the source code and build the native image

COPY src ./src
RUN ./mvnw -Pnative native:compile -DskipTests

======================================================================================

STAGE 2: Final Image

=================================com=====================================================

FROM gcr.io/distroless/cc-debian12
WORKDIR /app

Copy the native executable from the builder stage

COPY --from=builder /app/target/${ARTIFACT_NAME} .

If your app produces shared libraries (.so files), uncomment the next two lines

COPY --from=builder /app/target/*.so .

ENV LDLIBRARYPATH=.

Set the entrypoint

ENTRYPOINT ["./${ARTIFACT_NAME}"]
```


Extremely AI generated


Holy yikes


We're going to restart here because AI cannot write Dockerfiles


Can you share your respository? Are you using Springboot? What's the compilation error?


Lots of criticism, little help, poor support


To who? 🤨


a month ago

Please don't attempt to solve other's problems using AI. The Dockerfile you sent was incorrect. That is not helpful to the user reaching out to the community for assistance


First of all, I haven't solved anything because I don't know the problem the user is having. (You can see above that I asked what the error was.) The funny thing is that they criticize something that isn't even the solution; it's a Dockerfile trying to replicate what the user is doing. At no point have I said this is the solution, much less without knowing what the user's problem is. The funniest thing is that many hours have passed and no one has responded to the user, but they do have time to respond to me, criticizing and attacking me, "saying" that I use AI or that my Dockerfile is wrong. One comes here to help out of good will, but clearly I won't do it again. If you have any additional problems, I recommend you discuss them with me personally.


a month ago

If you still require help, please provide more context for the issue you’re having. Sharing logs or your repo would be helpful


azizbekx
FREE

a month ago

srr, guys, maybe this is more programming issue rather than railway problem. somehow managed to deploy but still when run compiled file there are compiling issue. maybe i need to know more about graalVM or just back to jvm


azizbekx
FREE

a month ago

since a while didn't open discord, srr again


azizbekx
FREE

a month ago

basicall i have this META-INF

my docker file
`# Stage 1: Build the native executable
FROM ghcr.io/graalvm/native-image-community:21 as native-builder

WORKDIR /app

COPY .mvn/ .mvn
COPY mvnw pom.xml ./

Download dependencies to leverage Docker cache

RUN ./mvnw dependency:go-offline

COPY src ./src

Compile the application into a native executable

RUN ./mvnw -Pnative native:compile -DskipTests

Stage 2: Create the final, minimal image for deployment

FROM debian:12-slim

WORKDIR /app

Install required system libraries.

- zlib1g: A common dependency for native images, providing libz.so.1.

- libfontconfig1 & libfreetype6: Often required for Java AWT/font management.

RUN apt-get update && \
apt-get install -y --no-install-recommends \
zlib1g \
libfontconfig1 \
libfreetype6 && \
rm -rf /var/lib/apt/lists/*

Copy the main executable from the builder stage

COPY --from=native-builder /app/target/ieltsx .

Copy any generated shared libraries (.so files) from the builder stage

COPY --from=native-builder /app/target/*.so .

Set the library path so the linker can find the copied .so files

ENV LDLIBRARYPATH=.

Set the entrypoint for the container

ENTRYPOINT ["./ieltsx"]`

now i have this random error
Caused by: java.util.ServiceConfigurationError: org.hibernate.bytecode.spi.BytecodeProvider: org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl Unable to get public no-arg constructor

Caused by: java.lang.NoSuchMethodException: org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl.()

after fixing this error one by adding to reflect-config.json
another error happening

I wonmder

1392831704946966500


GraalVM deploy - Railway Help Station