DEV Community


Posted on

Learning to deploy Spring boot Web Application to On Render(free tier)

After you make a spring boot web app using spring data jpa, thymeleaf, the next challenge comes when you want to deploy that app to show your colleagues or college friends.

There are very few free hosting services that allow you to deploy web apps.

I found one with the name of On render, which gave a free plan to host web services.

Image description

Even after I found the platform, there was still a challenge, how do I deploy the spring boot app? They have very good services for nodejs and others.

The only solution to that was to deploy using Docker.

For that, I had to make a docker file using the name "Dockerfile" without any extension, in the root directory of the project.

Image description

Finding the maven version that was required for the OpenJDK 19 was a headache.

Image description

after I set the version in the docker file, compile version was not matching with it so I had to set it manually in the pom.xml, which did the trick.

But after that it was easy, just needed to set the command to make a maven clean build on the docker container, expose the port, and set the entry point.

Then you just need to push it to git repo and connect it in onrender by creating a new web service.

After completing the build in the server you can run your web app on the given domain from on render.

You can check(might need some time (2-3min) to open as it is free hosting)

my weather app -->

my todo app -->

If you need help you can get in touch I can help you out

Top comments (0)