GraalVM deploy
azizbekx
FREEOP

10 months 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 LD_LIBRARY_PATH=.

ENTRYPOINT ["./x"]

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

project id

$10 Bounty

17 Replies

azizbekx
FREEOP

10 months ago

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


azizbekx
FREEOP

10 months ago

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


azizbekx
FREEOP

10 months ago

can someone share proper guidance to deploy graalvm + spring boot


10 months ago

What is the error you have?


10 months ago

# 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 LD_LIBRARY_PATH=.

# Set the entrypoint
ENTRYPOINT ["./${ARTIFACT_NAME}"]

10 months ago

Extremely AI generated


10 months ago

Holy yikes


10 months ago

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


10 months ago

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


10 months ago

Lots of criticism, little help, poor support


10 months ago

To who? 🤨


10 months 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


10 months ago

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.


10 months 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
FREEOP

10 months 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
FREEOP

10 months ago

since a while didn't open discord, srr again


azizbekx
FREEOP

10 months 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 LD_LIBRARY_PATH=.

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

1392831704946966651


Welcome!

Sign in to your Railway account to join the conversation.

Loading...