Cannot deploy Springboot app with a h2 database

I have this configuration in my Dockerfile

FROM jelastic/maven:3.9.5-openjdk-21 AS build
COPY . .
RUN mvn clean package -DskipTests

FROM oraclelinux:8-slim
COPY --from=build /target/petflix-0.0.1-SNAPSHOT.jar petflix.jar
EXPOSE 8080
CMD [“java”,“-jar”,“/app.jar”]

I also use a h2 database which is configured in my application.properties. The h2 is in the /data folder of my application. I use spring.datasource.url=jdbc:h2:file: (and all the other mandatory options) to connect

I tried a lot of technics to make the deploy pass, but every time I try, I always have the same results

I can see there is an 128 exit status but i cant find anything relevant on it.

I think this may have a link with the application.properties but i am not sure. Do you have any tips ?

Hi,

I have a very basic Spring Boot example that deploys and returns requests. Maybe that will help to compare to see if there’s any particular configuration you need to get your project up and running.

Render Web Services expect an HTTP web server to run binding to host 0.0.0.0 and a port. More in the docs: https://docs.render.com/web-services#port-binding

As for the database, you’ll need to note that Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).

If you want to persist data between restarts on your service, you’ll need to have a persistent store, e.g. a Render Disk (which is chargeable and also requires a paid instance type) or a database instance.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.