Spring boot Maven Project + java 21 Deployment issue

keitamohamed
HOBBY

a year ago

I am trying to deploy my Spring boot Maven project on Railway but I am getting
ERROR: docker.io/library/maven:3-openjdk-21: not found.
I am using java 21 and when try to deploy the app on Railway it give me an error. First I tried to deployed the app without using Dockerfile and it say Java version 21 is not supported. So I created a Dockerfile so Railway can use that file and I got this error docker.io/library/maven:3-openjdk-21: not found. I am not sure if this Dockerfile is right or not.

Her is what I have in my Dockerfile

FROM maven:3-openjdk-21 AS build-stage
WORKDIR /allinsoccer
COPY pom.xml .
RUN mvn dependency:go-offline

Package stage

COPY ./src ./src
RUN mvn clean install -Dmaven.test.skip=true

FROM openjdk:21-jdk AS production-stage
WORKDIR /allinsoccer
COPY --from=build-stage /allinsoccer/target/*.jar allinsoccer.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/allinsoccer/allinsoccer.jar"]

Build Logs

[Region: us-west1]

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

Using Detected Dockerfile

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

context: 8e98465b1d12492815747366def8cc5f

0 building with "default" instance using docker driver

1 [internal] load build definition from Dockerfile

1 transferring dockerfile: 426B done

1 DONE 0.0s

2 [internal] load metadata for docker.io/library/maven:3-openjdk-21

2 ERROR: docker.io/library/maven:3-openjdk-21: not found

3 [internal] load metadata for docker.io/library/openjdk:21-jdk

3 CANCELED

> [internal] load metadata for docker.io/library/maven:3-openjdk-21:

Dockerfile:1

1 | >>> FROM maven:3-openjdk-21 AS build-stage

2 | WORKDIR /allinsoccer

3 | COPY pom.xml .

ERROR: failed to solve: maven:3-openjdk-21: failed to resolve source metadata for docker.io/library/maven:3-openjdk-21: docker.io/library/maven:3-openjdk-21: not found

Build and run java version

java openjdk-21

Pom.xml Parent version

2 Replies

nickbeginner
HOBBY

a month ago

If i hardcode values, for example like this (with dummies values)

ktor: deployment: port: 8080 development: true auth: apiKey: internal: "S2Levonh3AWRYdPkQiNwLsF2YYTSHJVJNEnxW5GMuJCyTe42j9LyDuau3R5vcpZyCzCwuv" providers: mailgun: user: "admin" apiKey: "S2Levonh3AWRYdPkQiNwLsF2YYTSHJVJNEnxW5GMuJCyTe42j9LyDuau3R5vcpZyCzCwuv" endpoint: "https://default.mailgun.endpoint"

the service is deployed withous issues


nickbeginner
HOBBY

a month ago

i need an answer since we are deciding if we want to host our infrastructure on railways since we have a lot of microservices written using ktor


Spring boot Maven Project + java 21 Deployment issue - Railway Help Station